http://www.sikuli.org/

license: MIT
script language: Python

下面是他的一个hello world的例子,看看也挺有意思的。
开源的世界里有很多很有意思的东西,我们应该多抽点时间去了解他们,然后在不同的场景去用不同的工具就好了。

Hello World (Mac)

Let us begin with a customary Hello World example!

You will learn how to capture a screenshot of a GUI element and write a Sikuli Script to do two things:

  1. Click on that element
  2. Type a string in that element

The goal of the Hello World script is to automatically type “Hello World” into the spotlight search box, like this:

Now, open the Sikuli IDE. We begin by taking the screenshot of our target, the Spotlight symbol in the upper-right corner, so that we can tell Sikuli Script what to look for and click on.

To simulate a mouse click on the Spotlight symbol, we are going to use the click function. To tell Sikuli how the target looks like, we need to capture the target’s image on the screen.

Sikuli IDE provides two methods to capture screen images. The first method is to click on the camera button in the toolbar. This will bring you to the screen capturing mode.

The second method is to press a hot-key (Command + Shift + 2). Often the target whose image you wish to capture may be covered by the Sikuli IDE’s window. You can minimize the IDE’s window and use this hot-key to switch to the capturing mode.

In the screen capturing mode, the screen will look darker and freeze momentarily. The entire desktop becomes like a canvas where you can draw a rectangle around the target you want to capture an image of. In this case, the target is the spotlight symbol. The cross of red dotted lines shows the center of the rectangle you just drew.

After you have drawn (or selected) a rectangle, the image within the rectangle will be captured and inserted into the script editor at the current cursor position.

Now, you can write the click function using this image as an argument to tell Sikuli to click on spotlight symbol.

As a convenience, Sikuli IDE provides a Command List on the left panel. It shows a list of the most often used functions. Camera icons in the functions indicate these functions expect a captured image as an argument.

Locate the click() function in the list and click on it. If Auto Capture is on (default), you will be directed to the screen capturing mode in which you can capture an image of an interface target to be inserted into the click() function as an argument.

The next step is to tell Sikuli to enter the string “Hello World” into spotlight’s search box, which can be done with a simple typefunction.

This function will type the string given in the argument into whichever input control that has the focus. After clicking on the spotlight symbol, we can expect the spotlight search box will be the input that has the focus.

Congratulations! You have just completed your first Sikuli Script. Press the run button to see this script in action!

自动化测试: sikuli,一个基于界面图像的gui测试框架的更多相关文章

  1. GPUImage ==> 一个基于GPU图像和视频处理的开源iOS框架

    Logo 项目介绍: GPUImage是Brad Larson在github托管的开源项目. GPUImage是一个基于GPU图像和视频处理的开源iOS框架,提供各种各样的图像处理滤镜,并且支持照相机 ...

  2. Swift:一个基于.NET Core的分布式批处理框架

    Swift是什么 从文章的标题可知:此Swift非Apple那个Swift,只是考虑这个词的含义比较适合. Swift是一个基于.NET Core的分布式批处理框架,支持将作业分割后分发到多台服务器并 ...

  3. 一个基于Net Core3.0的WPF框架Hello World实例

    目录 一个基于Net Core3.0的WPF框架Hello World实例 1.创建WPF解决方案 1.1 创建Net Core版本的WPF工程 1.2 指定项目名称,路径,解决方案名称 2. 依赖库 ...

  4. Struts2是一个基于MVC设计模式的Web应用框架

    Struts2是一个基于MVC设计模式的Web应用框架,它本质上相当于一个servlet,在MVC设计模式中,Struts2作为控制器(Controller)来建立模型与视图的数据交互. Struts ...

  5. mk框架,一个基于react、nodejs全栈框架

    在这个前端技术爆炸的时代,不自己写套开源框架出门都不好意思跟别人打招呼,作为一个前端领域的小学生,去年年初接触了react,之后一发不可收拾爱上了它,近期重构了自己去年开源的一个项目,废话到此结束句号 ...

  6. 一个基于atomic的卖票测试

    package testAtomic; import java.util.concurrent.atomic.AtomicInteger; import sun.security.krb5.inter ...

  7. 推荐一个好用的E2E前端测试框架cypress

    Cypress 是一个E2E的前端自动化测试框架,同样是基于BDD的思想设计的,话不多说,上demo https://github.com/Spillage/cypress-demo PS, 还有一个 ...

  8. 转载:开发者眼中最好的 22 款 GUI 测试工具

    对于很多同学来说gui程序的测试是一个难点,所以我从网上转载了一篇关于gui测试的一篇文章,里面罗列的很多工具,大家可以尝试一下学习学习. 英文原文:22 best GUI testing tools ...

  9. 开发者眼中最好的 22 款 GUI 测试工具

    1.Abbot - Java GUI 测试框架 Abbot是一个基于GUI的简单的Java测试框架,它能够帮助开发者测试Java用户界面. 它提供事件自动生成和验证Java GUI组件,使您能够轻松地 ...

随机推荐

  1. android 显示意图

    //显示意图 public void enter(View view) { Intent intent = new Intent();//创建一个空的意图 intent.setClassName(ge ...

  2. 深入理解CSS中的层叠上下文和层叠顺序

    零.世间的道理都是想通的 在这个世界上,凡事都有个先后顺序,凡物都有个论资排辈.比方说食堂排队打饭,对吧,讲求先到先得,总不可能一拥而上.再比如说话语权,老婆的话永远是对的,领导的话永远是对的. 在C ...

  3. nginx配置入门

    谢谢作者的分享精神,原文地址:http://www.nginx.cn/591.html nginx配置入门 之前的nginx配置是对nginx配置文件的具体含义进行讲解,不过对于nginx的新手可能一 ...

  4. 颠覆式前端UI开发框架:React

    转自:http://www.infoq.com/cn/articles/subversion-front-end-ui-development-framework-react/ 基于HTML的前端界面 ...

  5. 快速解决mysql Lost connection to MySQL server at 'reading initial communication packet及can't connect to mysql server on 'localhost'

    今天在使用Navicat连一个远程mysql时,总是提示连接不成功,提示Lost connection to MySQL server at 'reading initial communicatio ...

  6. 使用Number.parseFloat引发的悲剧

    起因: 前几天,项目中有人用了Number.parseFloat(xxx)方法.在Chrome和FF中是可以使用的.然而在IE中却报错,提示不存在这个function. Solution: 经查Jav ...

  7. Windows Live Writer离线编写博客

    WLW最新版本为2012,官网下载 Windows Live Writer配置步骤 使用Windows Live Writer 2012和Office Word 2013 发布文章到博客园全面总结 L ...

  8. 23 其它话题 - 《Python 核心编程》

  9. linux内核宏container_of前期准备之gcc扩展关键字typeof

    typeof基本介绍 typeof(x) 这是它的使用方法,x可以是数据类型或者表达式.它的作用时期和sizeof类似,就是它是在编译器从高级语言(如C语言)翻译成汇编语言时起作用,这个很重要,稍后会 ...

  10. [转]Display PDF within web browser using MVC3

    本文转自:http://www.codeproject.com/Tips/697733/Display-PDF-within-web-browser-using-MVC Introduction I ...