How to use Sikuli for automated testing in Java

Source: Internet
Author: User

I wrote an article about Sikuli earlier. This article briefly describes how to use Sikuli in Java for automated testing.

Graphics scripting language Sikuli

Sikuli IDE can do common clicks, right-click, move to, drag and other mouse actions,java reference Sikuli-script.jar The same can be done with these common mouse actions, so it is easy to write a Java implementation to identify the image and simulate the click / drag target control.

Sikuli-script.jar:http://download.csdn.net/download/hqd1986/4557974

Add the Sikuli-script.jar package to Eclipse .

Then write the automated test script:

 PackageCom.mypro.sikuli;Importorg.sikuli.script.*; Public classStest { Public Static voidMain (string[] args)throwsfindfailed, interruptedexception {screen S=NewScreen (); //Define picture Storage pathString Imgpath = "d:/java/sikuli/img/"; //Double-click the Desktop Chrome browser iconS.doubleclick (imgpath+ "Chrome.png"); //Enter URLS.type (imgpath+ "Url.png", "www.bing.com"); S.click (Imgpath+ "Lianxiang.png"); Thread.Sleep (2000); //Enter search keywords in the bing input box: Sikuli, and click the Search buttonS.type (imgpath+ "sreach_input.jpg", "Sikuli"); S.click (Imgpath+ "Sreach_button.png"); System.out.println ("End"); }}

My Picture directory:

Execution log:

[INFO] Windows utilities loaded. [INFO] Sikuli Vision engine loaded. [Log] DOUBLE click on (185,450) [log] Click on (426,206"www.bing.com"[log] Click on (430,239 ) [log] Click on (685,370"Sikuli"[log] Click on (938,371) End

If the following error occurred while executing the script: Getting The VisionProxy.dll:Can not find dependent libraries ...

Add the Sikuli X libs directory to the System environment variable path :

Path:;D: \program Files (x86) \sikuli X\libs

What is Sikuli X? Please refer to the text link at the beginning of this article.

----------------------------------------------------

Error Reference:

Http://stackoverflow.com/questions/9568612/sikuli-windows-7-64-bit-getting-the-visionproxy-dll-can-not-find-dependent-li

How to use Sikuli for automated testing in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.