Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Selenium by (7k points)

How to write selenium java code for doubleClick() on a record using web driver?

I have displayed some records in the body part and once I clicked on a record we should get a popup window to update it.

I have tried the following code:

Actions action = new Actions(driver);

action.moveToElement(driver.findElement(By.xpath("//table/tbody/tr[2]/td/div/div/table/tbody/tr[10]/td[1]"))).doubleClick().build().perform();

1 Answer

0 votes
by (31.9k points)

You can use Actions class to perform mouse, keyboard actions on WebElements using WebDriver.

Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.xpath("//table/tbody/tr[2]/td/div/div/table/tbody/tr[10]/td[1]"))).doubleClick().perform();

Want to learn Selenium, checkout our Selenium training.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...