Sikuli in Java - How do I capture the screenshots/Png?

Mike picture Mike · Aug 28, 2012 · Viewed 9.2k times · Source
public class MyFirstSikuliTest {    
public static void main(String[] args) {
    App.open("C:\\Program Files\\Mozilla Firefox\\firefox.exe");
    Screen s = new Screen();
    try{    
            s.click("How do I take the screenshot and pass the path of the PNG here?", 0);
            s.wait("How do I take the screenshot and pass the path of the PNG here?");
            s.type(null, "WEBSITE NAME", 0);
    }
    catch(FindFailed e){
            e.printStackTrace();
    }
}
}

How do I take the screenshot and pass the path of the PNG into click method and wait method?? kindly help.

PS: I want to open firefox browser, click in the address bar, enter a website name and click enter.

Thanks!

Answer

phsym picture phsym · Aug 28, 2012

As explained here, just provide the path to the PNG image corresponding to the screenshot.

That screenshot can be created with any screenshot utility. I used to script with sikuli IDE which provides a simple way to create screenshots.

Hope it helped.