Sikuli Integration With Selenium Webdriver


Sikuli  image recognition method to identify GUI elements. Sikuli script allows users to automate GUI interaction by using screen shots. Sikuli tool working on image matchmethod. Sikuli take all the element as a image and store in the project. It will trigger the element when it matches the image. We pass the image with parameter.

Sikuli is very useful when we have do not any ID and name because it working on image recognition method. Its very useful when we have stable GUI.

Sikuli is also very useful for window application. We can automate the window application using sikuli. It provides the sikuli script jar file. We can download jar file from sikuli site.

Sikuli easily integrated with selenium webdriver.its open source tool.

First of all download the Sikuli-script jar file and include in your project.

Now we start the sikuli integration with selenium webdriver. So we make a simple application for Gmail login. For making the application We have to take screen-shot of username field, password, signin button.

usrnme.png

usrnme

usrnext.png

usrnext

password.png

password

signin.png

signin

These are the images which is necessary to implement the sikuli integration.

Now we create a class for implementing the sikuli.

 package sikuli;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;

public class GmailLogin {

public static void main(String[] args)
{

Screen screen = new Screen();

Pattern img1 = new Pattern("/home/manoj/Desktop/usrnme.png");
Pattern img2 = new Pattern("/home/manoj/Desktop/usrnext.png");
Pattern img3 = new Pattern("/home/manoj/Desktop/password.png");
Pattern img4 = new Pattern("/home/manoj/Desktop/signin.png");

WebDriver driver = new FirefoxDriver();

driver.get("http://www.gmail.com/");
driver.manage().window().maximize();
screen.type(img1,"manojmathpal4@gmail.com");
screen.click(img2);
screen.type(img3,"knoldus@123");
screen.click(img4);
screen.wait(img1, 10);
}
}
Advertisements
This entry was posted in Scala and tagged , , , . Bookmark the permalink.

One Response to Sikuli Integration With Selenium Webdriver

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s