Automate anything you see using Sikuli (an interesting GUI automation tool). As said Sikuli automates anything you see on-screen using the image recognition method to identify GUI elements on the screen.
Most of the automation testing tools will not support flash object automation (E.g. Selenium). Sikuli provides extensive support to automate flash objects. And also Sikuli provides support to automate desktop applications.
Selenium-Sikuli combination provides more support for the automation engineers. Most of the time in automation for web application, we may face to identify the elements from the web UI or the locators values are getting wrong. In such situation Sikuli comes in picture, Sikuli allows to automate GUI interaction by using images of elements instead of using the xpath, id, linktext, classes etc.,
Important steps to proceed
- Create a Maven project in Eclipse.
- Add following dependencies in pom.xml file:
- Create TestNG classes.
- Create WebDriver object to start driver session and load website.
- Create a folder inside src/main/resources and store the images of web elements inside that folder.
- Add the sikuli scripts to perform operations on the elements (like click, type, wait, doubleClick).
- Create a testng.xml file for the created TestNG class and execute testng.xml.
- Observe the results on executions.
Below is the sample Selenium-Sikuli Maven project structure:
Common Sikuli Actions
Create an object for Screen class, say Screen s = new Screen(); and perform various actions:
- click : s.click(<path to image>); – helps to click on web element using its image.
- rightClick : s.rightClick(<path to image>); – helps to right-click on web element using its image.
- doubleClick : s.doubleClick(<path to image>); – helps to double-click on web element that displaying in the view.
- find : s.find(<path to image>); – helps to locate a web element using the image of particular web objects.
- exists : s.exists(<path to image>); – helps to check the web element is present on the view.
- type : s.type(<path to image>, <input value to edit-box>); – helps to enter value to an input field.
- hover : s.hover(<path to image>); – helps to mouse hover a web element in the web page.
- wait : s.wait(<path to image>); – helps to wait for a web element on the page until it get displayed. There another method for wait is with timeout value, it looks like s.wait(<path to image>, <timeout in seconds>);
- dragDrop : s.dragDrop(<source image path>, <target image path>); – helps to drag an object(source image object) from one location and drop that object over other object (target image object) at target location.
Click here to get sample Selenium – Sikuli POC project and explore more. If you have any difficulty to get the POC project, please feel free to comment here.