如何双击Selenium webdriver中的webElements列表

问题描述 投票:0回答:2

从类似元素的列表中,我能够获得我想要的元素。

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 selenium selenium-webdriver
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.