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