How to double click an element using Selenium Webdriver

This is a dynamic list that we have on our site.

List Page

This is the HTML tag where I want to double click to.

<td class="dxgv" align="left" style="color: rgb(51, 51, 51); font-size: 13px; border-bottom: 1px solid rgb(237, 237, 237); border-left-width: 0px; border-right-width: 0px; width: 5.6em; max-width: 6em; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">Sun Kumar</td>

      

I want to double click on the first entry all the time, even if the first entry is deleted after each click

+3


source to share


1 answer


Since you want to double click on the first entry, you can try this Java code:

(Let's assume there is one table in the web page, since the full HTML is not available above, and the row for the content starts with a second.)

Actions act = new Actions(driver);
act.doubleClick(driver.findElement(By.xpath("//table//tr[2]//td[@class='dxgv'][1]"))).build().perform();

      



OR

 Actions act = new Actions(driver);
 act.moveToElement(driver.findElement(By.xpath("//table//tr[2]//td[@class='dxgv'][1]"))).doubleClick().build().perform();

      

+6


source







All Articles