Saturday 1 February 2014

Mouse Right click using WebDriver





Below script will give you an idea of using actions in your web driver script
Example Scenario for    RightClick :




  @Test
    public void rightClick() {
        driver.get("http://www.gmail.com");

        //WebElement draggable = driver.findElement(By.id("draggable"));
        WebElement element = driver.findElement(By.id("signIn"));
        Actions actions = new Actions(driver);
        actions.sendKeys(element, "Kit");
        actions.build().perform();
       
        WebElement link =driver.findElement(By.linkText("Learn more"));
        actions.contextClick(link);
        actions.build().perform();             
       
    }

No comments:

Post a Comment