Sikuli with Selenium: Combine the power of both desktop and web automation


import org.sikuli.script.*;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import org.openqa.selenium.firefox.*;
public class SikuliWithSelenium {
  * @param args
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  try {
   //Selenium code
   FirefoxProfile profile = new FirefoxProfile();     
   profile.setPreference("javascript.enabled", true); 
   FirefoxDriver fd = new FirefoxDriver(profile);

   fd.manage().window().setPosition(new Point(0,0));
   //java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
   //Dimension dim = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight());
   Dimension dim = new Dimension((int) 1600, (int) 860);
   CharSequence cs[] = { "xxxxxxxxxxxxxxxxxxxxx"};
   cs = new CharSequence[] {"xxxxxxxx"};

   //Sikuli code
   Settings.MinSimilarity = 0.9;
   Screen s = new Screen();
   s.wait("YourAccount.png", 180);
   s.wait("SignOut.png", 180);"SignOut.png", 0);
   //Image comparison code
   //Finder comp = new Finder("SignOutPage1.png");
   Finder comp = new Finder(s.capture(518, 140, 566, 497).getFilename());
   comp.find("Subset.png", 0.9);
   if(comp.hasNext()) {
    System.out.println("Image matched");
   } else {
    System.out.println("Image didn't match");

  } catch (Exception e) {
   // TODO Auto-generated catch block
This entry was posted in Information Technology. Bookmark the permalink.

One Response to Sikuli with Selenium: Combine the power of both desktop and web automation

  1. baba says:

    Disadvantages of using SIKULI in Selnium
    1. It limits the selenium RC, we can not use it remotely and it we can use selenium with sikuli as a standalone server
    2. It decreases the speed of selenium as sikuli click takes much more time compared to selenium click as sikuli first searches and matches then click.
    3. Sikuli takes more CPU resources than selenium

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s