从类似元素的列表中,我能够获得我想要的元素。
List<WebElement> expandQA = driver.findElements(By.xpath("//img[contains(@class, 'x-tree-expander')]/following-sibling::span[text()='QA']"))
expandQA.get(2);
现在我想双击该元素。我怎样才能做到这一点?
尝试使用以下代码,但出现错误。
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);
最佳答案
java代码...
Action action = new Actions(driver); action.doubleClick(myElemment); Action .perform();`
关于java - 如何双击 Selenium webdriver 中的 webElements 列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18908556/