How to double click using Selenium WebDriver
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class DoubleClickOnAnElement {
@Test
public void doubleClick() throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.in/");
Thread.sleep(3000);
WebElement element = driver.findElement(By.name("btnI"));
Actions action = new Actions(driver);
action.moveToElement(element).doubleClick().perform();
Thread.sleep(2000);
driver.close();
}
}
No comments:
Post a Comment