sikuli selenium webdriver testng testing with eclipse in windows

– Download sikuli-setup.jar from
http://www.sikuli.org/download.html
– Copy to a folder
– Double click on the jar file or run it from command prompt (make sure you have java installed 6/7), follow the instructions.
– In installation window preference select 4th and 6th checkboxes (we need that only/ if you want ide – you can select that also)
– Complete the installation.

– In eclipse create new project
– Add a class put below example
– Add build path
– Add external jars (Selenium jars and Sikuli jar – sikuli-java.jar (this will be created in the folder once you complete the sikuli setup)

---------
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.script.App;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
import org.testng.annotations.Test;</code>

public class sikuli{

@Test
public void sikuliTest(){

WebDriver driver = new FirefoxDriver();
driver.get("http://www.w3schools.com/");

//Create and initialize an instance of Screen object
Screen screen = new Screen();

//Add image path
Pattern image = new Pattern("http://www.w3schools.com/images/w3logo.png");// or path in the local directory

//Wait 10ms for image
screen.wait(image, 10);

//Click on the image
screen.click(image);
}
}

Run the script

– You will be getting some notification as updating path variable etc.

– If the system is not updating path variable automatically go through this notes http://doc.sikuli.org/faq/030-java-dev.html
– For more
http://doc.sikuli.org/faq/010-command-line.html

http://www.slideshare.net/vgod/practical-sikuli-using-screenshots-for-gui-automation-and-testing

No images available.