0

From a list of similar elements I was able to get the element I wanted.

List<WebElement> expandQA = driver.findElements(By.xpath("//img[contains(@class, 'x-tree-expander')]/following-sibling::span[text()='QA']"))
expandQA.get(2);

Now I want to double click on that element. How could I do that?

Tried using the below code but I'm getting a error.

        Actions actions = new Actions(driver);
        List<WebElement> expandQA = driver.findElements(By.xpath("//img[contains(@class, 'x-tree-expander')]/following-sibling::span[text()='QA']"));
        e = expandQA.get(2);
        actions.doubleClick(e);
2676698
  • 15
  • 1
  • 2
  • 5

2 Answers2

4

java code...

Actions action = new Actions(driver); action.doubleClick(myElemment); action.perform();`

Eshan Liyanagama
  • 576
  • 1
  • 7
  • 11
0

This should double-click on the element. import the following statements

import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;

create an object from Actions class(where the driver is your Webdriver object)

Actions action = new Actions(driver);

Write the code like below.

action.moveToElement(wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("your xpath here")))).doubleClick().perform();

This should perform the double-click.

Deepak N
  • 1,408
  • 3
  • 15
  • 37