Sikuli is an open source automation tool which is GUI based. Its purpose is to interact with elements of webpages and handling windows based popups. The main technique sikuli uses is of “Image Recognition” and “Control GUI”. Here the web elements are taken as images and stored inside the project. It is built with java allowing sikuli to run on windows,mac, Linux.
How to setup sikuli automation tool:
- Visit the website http://www.sikulix.com/
- Download the sikulixsetup.jar
- Keep it in an empty folder where you want keep all your sikulix files.
- Java should be installed for this tool to run.
- Run the jar, (install the pack 1)
- Sikuli will then proceed to setup.
The Interface
Sikuli comes with its own IDE (integrated development environment). Sikuli’s IDE is extremely powerful on its own. Without any programming knowledge we can make sikuli automate many tasks. It has many patterns like PSMRL.
P-Pattern: A pattern object
S-string: path to an image or just txt
M-match: A match from a previous find
R-region: A region object
L-Location: A location object, screen point.
We work with patterns as we can specify an image and a location to click. Patterns are the primary object we use in the series and patterns contain an image and information about that image ie. size, similarity and target offset.
Simple task to create a script
Create a script that opens the calculator app and ads 1+1 together.
Lets open sikuli IDE:
This IDE is opened by clicking the file sikullix.cmd
In the left side of the IDE we have different options like Find, Mouse actions and Keyboard actions.
Select the events from the given options one by one then it will allow selecting the image of the required command. Add one by one image according to the task. Using the left options select the click option. It will allow us to select the image. Then select the start button drag it to the IDE.
Then in the next line drag the calculator button as image by opening the application calculator. Drag the required keys for the operation one by one. Save and run the application.
We can also view the code in html code the sikuli creates the code of selected image in the html form.
When we open the file the actual script is created.
Practical uses of Sikuli
- Sikuli is used to automate flash objects/flash websites.
- It is useful to automate the windows based applications. What we see in the screen.
- It provides simple API; all methods are accessed using the screen class objects.
- Sikuli provides extensive support to automate flash objects.
- Using Sikuli we can automate desktop applications.
Benefits
- It is an open source tool.
- One of the biggest advantages of sikuli is that it can easily automate flash objects.
- The windows applications automated easily.
Some sikuli methods are:
- Creating object for screen class: The screen is the base class provided by sikulli.We need to create the object for this class and access all the methods.
Syntax:Screen s=new Screen();
- Click on an element: This is used to click a particular image present on the screen.
Syntax:s.click(“<<image name>>”);
- Find an element: This is used to find the particular element present on the screen.
Syntax:s.find(“<<image name>>”);
- Type a string on a TextBox:This method is used to enter the text on
The text box.Syntax:s.type(“<<image name>>”,”String to be typed”);