Software QA FYI - SQAFYI

Sikuli GUI Automation Tool Tutorial

By:

Introduction

Sikuli is a tool to automate graphical user interfaces (GUI) using “Visual Image Match” method. In Sikuli, all the web elements should be taken as an image and stored inside the project. Sikuli will trigger GUI interactions based on the image visual match, the image which we have passed as the parameter along with all methods.

Sikuli can be very much useful to automate flash objects (which do not have ID or name). It can be useful in the situation, where we have a stable GUI (i.e. GUI components not changing).

Even Window based applications can also be automated using Sikuli. Sikuli provides very friendly Sikuli-script.jar, which can be easily used together with Selenium WebDriver. We can even automate Adobe Video/Audio player, Flash Games on website using Sikuli. With simple API, it makes coding easier.

Steps to Create Sikuli Java Project:
Step #1: Sikuli Download - Download Sikuli from here.
Step #2: Extract the zip file which you’ve downloaded. It will contain sikuli-script.jar file. Save this extracted file in your local file system.
Step #3: Open Eclipse.
Step #4: Create a java project File -> New -> Java Project
Step #5:
Right Click on the project
Go to Build path -> Configure Build Path
Switch to Libraries tab
Click “Add External Jars” button and Add Sikuli-Script.jar in the Build path.
Click “Ok”

Some Sikuli Methods:
#1: Creating Object for Screen Class Screen is a base class provided by Sikuli. We need to create object for this screen class first, then only we can access all the methods provided by Sikuli.
Syntax:
Screen s=new Screen();
#2: Click On An Element
This method used to Click on the specific image present on the screen.
Syntax:
s.click(“<<image name>>”);
Example:
s.click(“test.png”);
#3: Right Click On An Element
This method used to right click on the specific image present on the screen.
Syntax:
s.rightClick(“<<image name>>”);
Example:
s.rightClick(“test.png”);
#4: find An Element
This method used to find a specific element present on the screen.
Syntax:
s.find(“<<image name>>”);
Example:
s.find(“test.png”);
#5: Double Click on An Element
This method used to trigger double click event on a specific image present on the screen.
Syntax:
s.doubleClick(“<<image name>>”);
Example:
s.doubleClick(“test.png”);
#6: Check whether an Element present on the Screen
This Method is used to check whether the specified element is present on the screen.
Syntax:
s.exists(“<<image name>>”);
Example:
s.exists(“test.png”);
#7: Type a string on a Textbox
This Method is used to enter the specified text on the Text box.
Syntax:
s.type(“<<image name>>”,”String to be typed”);
Example:
s.type(“test.png”,”HI!!”);
#8: Wheeling on a particular image
This method is used to perform wheeling action on the element image.
Syntax:
s.wheel(“<<image name>>”,<<int position>>,<<int direction>>);
Example:
s.wheel(“test.png”,25,0);
#9: Drag and Drop a Image/Element
This method is used to drag and drop a specified image from source position to target position.
Syntax:
s.dragDrop(“<<source image name>>”,”<<target image name>>”);
Example:
s.dragDrop(“test.png”,”test1.png”);

Full article...


Other Resource

... to read more articles, visit http://sqa.fyicenter.com/art/

Sikuli GUI Automation Tool Tutorial