Thursday, January 12, 2012

Simulate click using javascript for webdriver

        driver.get("http://www.google.com");
        JavascriptExecutor js =  (JavascriptExecutor)driver;

        WebElement upload = driver.findElement(By.name("btnI"));
        ((JavascriptExecutor)driver).executeScript("arguments[0].click();", upload);

1 comment:

  1. Thanks for the sample code! But looks like your js var was never used.

    ReplyDelete