`
MyEyeOfJava
  • 浏览: 1157031 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
7af2d6ca-4fe1-3e9a-be85-3f65f7120bd0
测试开发
浏览量:71350
533896eb-dd7b-3cde-b4d3-cc1ce02c1c14
晨记
浏览量:0
社区版块
存档分类
最新评论

[sikuli]-控制你的sikuli脚本以及行为

 
阅读更多

 

setShowActions(False | True)

If set to True, when a script is run, Sikuli shows a visual effect (a blinking double lined red circle) on the spot where the action will take place before executing actions (e.g.click()dragDrop()type(), etc) for about 2 seconds in the standard (see Settings.SlowMotionDelay ). The default setting is False.

exit([value])

Stops the script gracefully at this point. The value is returned to the calling environment.

class Settings

New in version X1.0-rc2.

Settings.ActionLogs
Settings.InfoLogs
Settings.DebugLogs

Either option might be switched on (True) or off (False), to show or hide the respective message type in the IDE console or on command line ([log], [info], [debug]).

Settings.MinSimilarity

The default minimum similiarty of find operations. While using a Region.find() operation, if only an image file is provided, Sikuli searches the region using a default minimum similarity of 0.7.

Settings.MoveMouseDelay

Control the time taken for mouse movement to a target location by setting this value to a decimal value (default 0.5). The unit is seconds. Setting it to 0 will switch off any animation (the mouse will “jump” to the target location).

As a standard behavior the time to move the mouse pointer from the current location to the target location given by mouse actions is 0.5 seconds. During this time, the mouse pointer is moved continuosly with decreasing speed to the target point. An additional benefit of this behavior is, that it gives the active application some time to react on the previous mouse action, since the e.g. click is simulated at the end of the mouse movement:

mmd = Settings.MoveMouseDelay # save default/actual value
click(image1) # implicitly wait 0.5 seconds before click
Settings.MoveMouseDelay = 3
click(image2) # give app 3 seconds time before clicking again
Settings.MoveMouseDelay = mmd # reset to original value
Settings.DelayAfterDrag
Settings.DelayBeforeDrop

DelayAfterDrag specifies the waiting time after mouse down at the source location as a decimal value (seconds).

DelayBeforeDrop specifies the waiting time before mouse up at the target location as a decimal value (seconds).

Usage: When using Region.dragDrop() you may have situations, where the operation is not processed as expected. This may be due to the fact, that the Sikuli actions are too fast for the target application to react properly. With these settings the waiting time after the mouse down at the source location and before the mouse up at the target location of a dragDrop operation are controlled. The standard settings are 0.3 seconds for each value. The time that is taken, to move the mouse from source to target is controlled by Settings.MoveMouseDelay:

# you may wish to save the actual settings before
Settings.DelayAfterDrag = 1
Settings.DelayBeforeDrop = 1
Settings.MoveMouseDelay = 3
dragDrop(source_image, target_image)
# time for complete dragDrop: about 5 seconds + search times
Settings.SlowMotionDelay

Control the duration of the visual effect (seconds).

Settings.WaitScanRate
Settings.ObserveScanRate

Specify the number of times actual search operations are performed per second while waiting for a pattern to appear or vanish.

As a standard behavior Sikuli internally processes about 3 search operations per second, when processing a Region.wait()Region.exists()Region.waitVanish(),Region.observe()). In cases where this leads to an excessive usage of system ressources or if you intentionally want to look for the visual object not so often, you may set the respective values to what you need. Since the value is used as a rate per second, specifying values between 1 and near zero, leads to scans every x seconds (e.g. specifying 0.5 will lead to scans every 2 seconds):

def myHandler(e):
        print "it happened"

# you may wish to save the actual settings before
Settings.ObserveScanRate = 0.2
onAppear(some_image, myHandler)
observe(FOREVER, background = True)
# the observer will look every 5 seconds
# since your script does not wait here, you
# might want to stop the observing later on ;-)

New in version X1.0-rc2.

Settings.ObserveMinChangedPixels

The minimum size in pixels of a change to trigger a change event when using Region.onChange() without specifying this value. The default value is 50.

 

分享到:
评论

相关推荐

    sikuli-ui自动化简易工具

    通过运行这个脚本,用户可以在没有图形用户界面的情况下执行 Sikuli 脚本。 2. **sikulix.jar**:这是 Sikuli X 的主程序文件,包含所有必需的库和引擎,用于执行基于图像识别的自动化操作。 3. **sikulixapi.jar*...

    Sikuli IDE便携版

    在实际应用中,Sikuli IDE常被用于Web应用测试、桌面应用测试、移动应用测试以及一些需要大量手动点击的场景。例如,你可以用它来自动化注册流程、登录操作,甚至游戏中的某些重复动作。不过,需要注意的是,由于...

    sikuli介绍文档

    Sikuli的可视化测试脚本非常适合进行回归测试,因为它们可以清晰地展示出软件行为的变化。 ##### 3.3 测试驱动开发(TDD) 在测试驱动开发方法中,开发者首先编写测试用例,然后编写满足这些测试用例的代码。Sikuli的...

    基于sikuli的自动化测试研究与应用

    Sikuli脚本通常以.jpg、.png或者.gif等图像文件作为输入,这些图像代表了GUI上需要操作的按钮、链接、输入框等元素。Sikuli通过分析屏幕上的图像与脚本中提供的图像之间的相似度,来确定在屏幕上应该进行何种操作。...

    电信设备-基于Sikuli的操作信息封装方法及装置.zip

    9. **版本控制**:利用版本控制系统管理Sikuli脚本,便于团队协作和历史追踪。 通过学习和应用这些知识点,可以有效地利用Sikuli提升电信设备管理的自动化水平,降低人工操作成本,提高工作效率,并减少人为错误。...

    Cognizant-Intelligent-Test-Scripter:无脚本测试自动化解决方案

    认知智能测试脚本 Cognizant Intelligent Test Scripter是一种无脚本的开源测试自动化解决方案,可为所有“日常”测试自动化活动(例如测试设计,开发,执行,报告和维护)提供统一的界面。 客户参与度调查 感谢您...

    Fate-Grand-Order_Lua:Fate大订单自动战斗脚本-无需root,仅适用于Android

    在FGO自动战斗脚本中,Lua被用于编写控制游戏行为的指令序列。通过Lua脚本,玩家可以定制化战斗策略,如技能释放顺序、目标选择等,从而实现个性化和高效的自动战斗。 接下来,我们要提到的是自动化。在Android环境...

    Python-LackeyPython图形桌面自动化

    Lackey与Sikuli的兼容性意味着现有Sikuli脚本可以相对轻松地迁移到Python环境中,扩大了工具的适用范围。同时,Lackey作为一个Python库,可以与其他Python库如PIL(Python Imaging Library)结合,提供更多的图像...

    TestingWebsite:使用Grid和Sikuli搜索演员的名字

    3. **远程控制**:通过Grid,你可以在一个中央服务器上启动测试,而实际的浏览器会话可以在远程机器上运行。 4. **录制回放**:虽然Selenium Grid本身并不支持录制回放,但可以通过与其它工具(如Sikuli)结合使用...

    RobotFramework+selenium自动化测试-齐涛博客教程整理

    这种组合允许测试人员使用一种简洁且易于理解的语言编写自动化测试脚本,并通过Selenium Library来控制浏览器执行各种操作。 **1.1 RobotFramework简介** - **易于使用**:采用表格形式的语法,简化了测试用例的...

    WATIR-WEBDRIVER自动化学习指导

    WATIR(Web Application Testing In Ruby)与WebDriver的结合提供了强大的功能和灵活性,使得测试人员能够模拟真实用户的操作行为对Web应用程序进行自动化测试。 #### 二、支持的浏览器 WATIR-WEBDRIVER支持多种...

    DocPyAutoGUI.pdf

    1. **鼠标操作**:通过PyAutoGUI,开发者能够精确地控制鼠标的移动、点击、双击、拖拽等行为,并且这些操作可以在屏幕上的任意位置执行。例如,`pyautogui.moveTo()`用于将鼠标移动至指定坐标,而`pyautogui.click()...

Global site tag (gtag.js) - Google Analytics