Double Click in Selenium WebDriver
doubleClick()
By using doubleClick Method We Right Click In selenium
Syntax-
WebElement Rclick =driver.findElement(By.xpath("//*[@id=\"u_0_8\"]"));
Actions act = new Actions(driver);
act.doubleClick(Rclick).perform();
Selenium Code For Double Click
package automationtesting;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import
org.openqa.selenium.chrome.ChromeDriver;
import
org.openqa.selenium.interactions.Actions;
public class DoubleClick {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","D:\\Sandeep\\Soft\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com/");
WebElement Rclick =driver.findElement(By.xpath("//*[@id=\"u_0_8\"]"));
Actions act = new Actions(driver);
act.doubleClick(Rclick).perform();
}
}
0 Comments