- 浏览: 1156959 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
MyEyeOfJava:
产生问题的主要原因:1.方洪波与南枫公司的直接主管李琼在合作共 ...
人力资源管理案例-左右为难的经理 -
吾名长弓:
学习了,作为一个管理新手,从文章里学到了很多东西,感谢 ...
2018新年管理感言 -
MyEyeOfJava:
非常不错,看过很多文章,说到管理者必然不能抛弃技术,我的主张是 ...
IT行业技术部门人员架构设计 -
小灯笼:
JMeter测试从入门到精通网盘地址:https://pan. ...
LR与Jmeter相关资料 -
flying6071:
“(2)CERT.SF:这是对摘要的签名文件。对前一步生成的M ...
Android签名与认证详细分析之一(CERT.RSA剖析)
General Settings and Access to Environment Information
Sikuli Level
Sikuli internally uses the class Settings to store globally used settings. Publicly available attributes may be accessed by using Settings.[name-of-an-attribute] to get it’s value and Settings.attribute = value to set it. It is highly recommended to only modify attributes, that are described in this document or when you really know, what you are doing.
Actually all attributes of some value for scripting are described in the topic Controlling Sikuli Scripts and their Behavior.
Jython/Python Level
You may use all settings, that are defined in standard Python/Jython and that are available in your system environment. The modules sys and time are already imported, so you can use their methods without the need for an import statement.
sys.path may be one of the most valuable settings, since it is used by Python/Jython to locate modules, that are referenced using import module. It is a list of path’s, that is e.g. maintained by Sikuli to implement Importing other Sikuli Scripts as a standard compliant feature.
If you want to use sys.path, it is recommended to do it as shown in the following example, to avoid appending the same entry again:
myPath = "some-absolute-path"
if not myPath in sys.path:
sys.path.append(myPath)
Java Level
Java maintains a global storage for settings (key/value pairs), that can be accessed by the program/script. Sikuli uses it too for some of it’s settings. Normally it is not necessary to access these settings at the Java level from a Sikuli script, since Sikuli provides getter and setter methods for accessing values, that make sense for scripting. One example is the list of paths, that Sikuli maintains to specify additional places to search for images (please refer to Importing other Sikuli Scripts for more information).
If needed, you may access the java settings storage as shown in the following example:
import java
# get a value
val = java.lang.System.getProperty("key-of-property")
# set a property's value
java.lang.System.getProperty("key-of-property", value)
Image Search Path
Sikuli maintains a list of locations to search for images when they are not found in the current .sikuli folder (a.k.a. bundle path). This list is maintained internally but can be inspected and/or modified using the following functions:
Get a list of paths where Sikuli will search for images.
# getImagePath() returns a Java array of unicode strings
imgPath = list(getImagePath()) # makes it a Python list
# to loop through
for p in imgPath:
print p
Add a new path to the list of image search paths
Remove a path from the list of image search paths
Note: paths must be specified using the correct path separators (slash on Mac and Unix and double blackslashes on Windows).
This list is automatically extended by Sikuli with script folders, that are imported (see: Importing other Sikuli Scripts), so their contained images can be accessed. If you want to be sure of the results of your manipulations, you can use getImagePath and check the content of the returned list. When searching images, the path’s are scanned in the order of the list. The first image file with a matching image name is used.
Note: Behind the scenes this list is maintained in the java property store with the key SIKULI_IMAGE_PATH. This can be preset when starting the JVM using the environment variable SIKULI_IMAGE_PATH and can be accessed at runtime using the approach as mentioned under Accessing Settings - Java level. Be aware, that this is one string, where the different entries are separated with a colon ( : ).
The default bundle path can also be accessed and modified by the two functions below:
Set the path for searching images in all Sikuli Script methods. Sikuli IDE sets this automatically to the path of the folder where it saves the script (.sikuli). Therefore, you should use this function only if you really know what you are doing. Using it generally means that you would like to take care of your captured images by yourself.
Additionally images are searched for in the SIKULI_IMAGE_PATH, that is a global list of other places to look for images. It is implicitly extended by script folders, that are imported (see: Reuse of Code and Images).
Get a string containing a fully qualified path to a folder containing your images used for finding patterns. Note: Sikuli IDE sets this automatically to the path of the folder where it saves the script (.sikuli). You may use this function if, for example, to package your private files together with the script or to access the picture files in the .sikuli bundles for other purposes. Sikuli only gives you to access to the path name, so you may need other python modules for I/O or other purposes.
Other places, where Sikuli looks for images, might be in the SIKULI_IMAGE_PATH.
Other Environment Information
Get the type ( getOS() ) and version ( getOSVersion() ) of the operating system your script is running on.
An example using these methods on a Mac is shown below:
# on a Mac
myOS = Env.getOS()
myVer = Env.getOSVersion()
if myOS == OS.MAC:
print "Mac " + myVer # e.g., Mac 10.6.3
else:
print "Sorry, not a Mac"
myOS = str(Env.getOS())
if myOS == "MAC" or myOS.startswith("M"):
print "Mac " + myVer # e.g., Mac 10.6.3
else:
print "Sorry, not a Mac"
New in version X1.0-rc2.
Get the version of Sikuli.
a string containing the version text of the IDE window title without “Sikuli “ |
An example for Sikuli X-1.0rc2:
if not Env.getSikuliVersion() == "X-1.0rc2":
print "This script needs Sikuli X-1.0rc2"
exit(1)
Get the content of the clipboard if it is text, otherwise an empty string.
Note: Be careful, when using Env.getClipboard() together with paste(), since paste internally uses the clipboard to transfer text to other applications, the clipboard will contain what you just pasted. Therefore, if you need the content of the clipboard, you should call Env.getClipboard() before using paste().
Tip: When the clipboard content was copied from a web page that mixes images and text, you should be aware, that there may be whitespace characters around and inside your text, that you did not expect. In this case, you can use Env.getClipboard().strip() to get rid of surrounding white spaces.
New in version X1.0-rc2.
Get the current status ( on / off ) off the respective key. Only one key can be specified.
|
True if the specified key is on, False otherwise |
Further information about key constants can be found in Class Key.
New in version X1.0-rc2.
Get the current location of the mouse cursor.
a Location object of the position of the mouse cursor on the screen. |
发表评论
-
[sikuli]ubuntu下安装sikuli
2012-05-03 15:16 2163会报错:libml.so.2.1 cannot open sh ... -
[sikuli]-事件监听器
2011-11-01 12:31 2140Listening to Global Hotkeys ... -
[sikuli]-sikuli与用户的交互
2011-11-01 12:31 1548popup(text[, title]) ... -
[sikuli]-控制你的应用程序和窗口
2011-11-01 12:30 4103Here we talk about opening ... -
[sikuli]-控制你的sikuli脚本以及行为
2011-10-31 16:59 2907setShowActions(False | Tr ... -
[sikuli]-导入代码库和Jar
2011-10-31 16:56 2282# an example - choose your o ... -
[sikuli]-新特性,代码复用,强壮[everything]
2011-10-31 13:42 1373我的其他几篇文章: [sikuli]-siku ... -
[sikuli]-怎样在Eclipse与NetBean中使用sikuli
2011-10-31 13:39 1722在这篇文章里,我建议 ... -
[sikuli]-python脚本的一个简单例子
2011-10-31 11:51 3460def setUp(self): openApp ... -
[sikuli]-怎样在Java程序中运行你的sikuli脚本
2011-10-28 09:57 6179sikuli的核心内容是使用java进行编写的,这意味着你可以 ... -
[sikuli]-怎样为GUI创建单元测试脚本
2011-10-28 09:57 2473sikuli支持junit单元测试,在IDE里(windows ... -
[sikuli]-有关于sikuli的一点解释
2011-10-27 11:34 2367你能使用sikuli做什么,在什么地方可以使用? *如果你使 ... -
[sikuli]-设置窗口大小
2011-10-27 11:24 2731我们可以拖拽窗口的右下角来改变窗口的大小,那么我们就必须知道当 ... -
[sikuli]-while循环以及popup弹出窗
2011-10-27 11:05 7907这里以sns例,假如你想 ... -
[sikuli]-拖拽动作dragDrop
2011-10-27 10:34 2220样例图片: t = find ( ... -
[sikuli]-For与below
2011-10-27 10:28 2071sikuli中的For循环: ...
相关推荐
Sikuli-Script,可以结合selenium使用,操作浏览器的插件栏地址栏之类的HTML结构之外的区域。本jar包是2021年1月的最新版本。后续应该有更新的。
压缩包中的唯一文件"Sikuli-X-1.0rc3 (r905)-win32.exe"是Sikuli X的安装程序,适用于32位Windows操作系统。用户只需运行这个文件,按照向导提示进行安装,即可在自己的机器上部署Sikuli X环境,开始进行GUI自动化...
在java中使用sikuli所需要的jar包。 对应sikuli的1.0最新版本。
sikuli-slides_windows-x64_1_5_0
点点鼠标,即可实现软件测试自动化,很简单,快来试试吧
sikuli-slides_windows_1_5_0
1. "Sikuli-X-1.0rc3 (r905)-win32.exe":这是Sikuli的一个早期版本的Windows安装程序,版本号为1.0 Release Candidate 3,修订版为905。用户可以运行这个程序来安装Sikuli,以便在Windows环境下使用。 2. "西西...
sikuli-ide.exe sikuli的安装包
一款基于图像匹配技术的开源自动化测试框架。可以与其他测试框架集成使用。附上一篇介绍文:http://www.softwaretestinghelp.com/sikuli-tutorial-part-1/# 文中有sikuli的简介、安装及一些使用方法
- **跨平台支持**:Sikuli 支持 Windows、Mac OS X 和 Linux 操作系统,适应各种环境的自动化需求。 - **简单易用的脚本语言**:Sikuli 使用 Python 的一种方言,称为 Sikuli Script,语法简洁,易于学习。 - **集成...
New per 2014 Feb 20th: Having problems with bundled libVisionProxy.so? Try to build it using this package. NEW VERSION: More Automatics! Should do the job on more Linux systems (for version 1.0.1 ONLY...
只需将包含"Sikuli-r930-win32"的压缩包解压到任意位置,即可开始工作,节省了安装和配置的时间。 Sikuli IDE内部集成了Jython解释器,允许用户用类似Python的语法编写测试脚本。它提供了丰富的API,用于创建、匹配...
Sikuli是基于图形的脚本语言,本资源包含最新版1.1.2的sikuli安装包及相关依赖包,下载点击runsikulix.cmd可一键启动,无需联网下载安装。 新版的1.1.2版本亲测可支持jdk1.8.
三、 我们将下载的文件sikuli-r930-win32.zip解压,然后得到一个SIKULI-IDE 的目录,把SIKULI-IDE目录下的所有文件替换Sikuli X下的所有文件。(这种做法有点2了!)做这一步的目的是r930关联文件修复了了最近的bug ...
它的核心功能是基于图像识别,使得用户可以编写脚本来模拟人类在屏幕上的操作,如点击按钮、填写表单、拖放对象等。这个技术尤其适用于那些无法通过传统编程方式交互的界面,比如网页中的Flash元素或者桌面应用的...
AutoIt、Genie、Sikuli 的跨平台实用程序 ... 该项目分为两部分: (1) AutoITExecutor--它是用于处理原生windows事件以及flash自动化的...需要为要在其上运行测试的特定平台设置环境。 有关特定平台要求,请参见下文。 作
#手动的东西转到框中的顶部工具栏并将语言从德语更改为英语打开桌面上的 sikuli 文件夹并在其中运行 jar ... 选中每个框,然后单击“立即设置” 现在你可以通过双击 sikuli 文件夹中的 sikuli-ide.jar 来运行 sikuli
MIT的研究人员设计了一种新颖的图形脚本语言Sikuli,计算机用户只须有最基本的编程技能(比如会写print"hello world"),他不需要去写出一行行代码,而是用屏幕截图的方式,用截出来的图形元素组合出神奇的程序。