Road to handle file download popup in webdriver using Sikuli

In this post I will show you how to integrate webdriver test script with Sikuli automation tool to handle window popup utility like file download and upload etc.
Here I take example of a file download window popup utility, which we can not handle by using webdriver functions. Some people use different-2 automation tool like AutoIt, java Robot class to handle this.
Here is an example of webdriver sikuli integration to handle below selenium jar file download window popup utility.

Here is an example of webdriver sikuli integration to handle popup utility.

public class WebdriverSikuli {

    private WebDriver driver;
    private String baseUrl;
    private Screen screen;

    @BeforeSuite
    public void setUp() throws Exception {
                         driver = new FirefoxDriver();
                         screen = new Screen();
                         baseUrl = "http://docs.seleniumhq.org/download/";
                         driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }

    @Test
    public void testUntitled() throws Exception {
                         driver.get(baseUrl + "/");
                         driver.findElement(By.linkText("2.35.0")).click();
                         screen.click("images/SaveFileButton.png");
    }

    @AfterSuite
    public void tearDown() throws Exception {
                         driver.quit();
    }
}


  1. In above example first of all you need to add “sikuli-script.jar” jar file to your project class path.
  2. Import Sikuli class >>>import org.sikuli.script.Screen;
  3. Create Screen class object and class click() method by passing image of save button .
  4. In above example “SaveFileButton.png” is image of save button and I put “images” folder under my project.


2 comments:

Leave your comments, queries, suggestion I will try to provide solution