RE: How to double click on Web element in Selenium

Answered

Hi,

Can anyone help me with the code for double clicking on a Web element.I tried a lot but couldn’t perform it and its holding my automation work>
I tried below code but its throwing an error,

Actions Useraction = new Actions(driver);
Useraction.moveToElement(driver.findElement(By.xpath(“.//*[@id=’testuser@hcl.com’]/div[2]/div/img”))).doubleClick().build().perform();

Add Comment
2 Answers

Hi Naresh,

Exception clearly states that there is no element present on the web page corresponding to the Xpath locator you have mentioned.

Exception in thread “main” org.openqa.selenium.NoSuchElementException: Unable to locate element: {“method”:”xpath”,”selector”:”.//*[@id=’testuser@hcl.com’]/div[2]/div/img”}

Get the right locator for the element and the code mentioned in the question will work for you.

Virender

Professor Answered on June 8, 2015.

Thank You Virender….

on June 8, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.