自动化测试: sikuli,一个基于界面图像的gui测试框架
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:
- Click on that element
- 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测试框架的更多相关文章
- GPUImage ==> 一个基于GPU图像和视频处理的开源iOS框架
Logo 项目介绍: GPUImage是Brad Larson在github托管的开源项目. GPUImage是一个基于GPU图像和视频处理的开源iOS框架,提供各种各样的图像处理滤镜,并且支持照相机 ...
- Swift:一个基于.NET Core的分布式批处理框架
Swift是什么 从文章的标题可知:此Swift非Apple那个Swift,只是考虑这个词的含义比较适合. Swift是一个基于.NET Core的分布式批处理框架,支持将作业分割后分发到多台服务器并 ...
- 一个基于Net Core3.0的WPF框架Hello World实例
目录 一个基于Net Core3.0的WPF框架Hello World实例 1.创建WPF解决方案 1.1 创建Net Core版本的WPF工程 1.2 指定项目名称,路径,解决方案名称 2. 依赖库 ...
- Struts2是一个基于MVC设计模式的Web应用框架
Struts2是一个基于MVC设计模式的Web应用框架,它本质上相当于一个servlet,在MVC设计模式中,Struts2作为控制器(Controller)来建立模型与视图的数据交互. Struts ...
- mk框架,一个基于react、nodejs全栈框架
在这个前端技术爆炸的时代,不自己写套开源框架出门都不好意思跟别人打招呼,作为一个前端领域的小学生,去年年初接触了react,之后一发不可收拾爱上了它,近期重构了自己去年开源的一个项目,废话到此结束句号 ...
- 一个基于atomic的卖票测试
package testAtomic; import java.util.concurrent.atomic.AtomicInteger; import sun.security.krb5.inter ...
- 推荐一个好用的E2E前端测试框架cypress
Cypress 是一个E2E的前端自动化测试框架,同样是基于BDD的思想设计的,话不多说,上demo https://github.com/Spillage/cypress-demo PS, 还有一个 ...
- 转载:开发者眼中最好的 22 款 GUI 测试工具
对于很多同学来说gui程序的测试是一个难点,所以我从网上转载了一篇关于gui测试的一篇文章,里面罗列的很多工具,大家可以尝试一下学习学习. 英文原文:22 best GUI testing tools ...
- 开发者眼中最好的 22 款 GUI 测试工具
1.Abbot - Java GUI 测试框架 Abbot是一个基于GUI的简单的Java测试框架,它能够帮助开发者测试Java用户界面. 它提供事件自动生成和验证Java GUI组件,使您能够轻松地 ...
随机推荐
- iOS开发网络篇—网络编程基础(二)
下面叙述的是关于几个必须要知道的iOS网络编程入门级别的要点: 1.客户端如何找到连接的服务器 客户端通过URL找到想要连接的服务器 2.什么是URL URL的全称是Un ...
- iOS证书失效
iOS证书突然失效 今早上班打包直接报错,错误如图 根据错误信息到“钥匙串”里面看了一下证书,证书都莫名其妙的失效了,昨天还是好好的. 重新去钥匙串从证颁发中心获取证书,然后登陆开发者账号重新申请证书 ...
- UVa 101 - The Blocks Problem(积木问题,指令操作)
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&pa ...
- dig与dns基本理论——解析和缓存
DNS(Domain Name System,域名系统)也许是我们在网络中最常用到的服务,它把容易记住的域名,如 www.google.com 翻译成人类不易记住的IP地址,如 173.194.127 ...
- SQL 在表中随机取数据
在一张10万行产品表(Product)中,随机取10条数据的几种方式: SET STATISTICS IO ON SELECT TOP 10 ID FROM dbo.Product(NOLOCK) W ...
- Java 图片处理——如何生成高清晰度而占有磁盘小的缩略图
现在的web项目,图片越来越多,图片大小也越来越大,随便就能达到1M,2M,甚至更大.用户上传的图片,一般是无法直接使用的.一般要生成两三种对应的缩略图,分别适配不同的终端,不同的场景.比如PC,手机 ...
- android中progress进度条的使用
activity.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" ...
- 解决 Eclipse 项目有红感叹号的方法
原因:显示红色感叹号是因为jar包的路径不对 解决: 在项目上右击:Build Path -> Configure Build Paht...(或Propertise->Java Buil ...
- python enumerate 函数用法
enumerate字典上是枚举.列举的意思. C语言中关键字enum也是enumerate的缩写. python中enumerate方法,返回一个enumerate类型.参数一般是可以遍历的的 ...
- mysql中count(),group by使用
count()统计表中或数组中记录 count(*)返回检索行的数目,且不论其值中是否包含NULL count(column_name)返回的是对列中column_name不为NULL的行的统计 例如 ...