【发布时间】:2020-05-12 08:59:52
【问题描述】:
我想为可见元素创建一个 XPath。我尝试了这两种技术。
1. By locator = By.xpath("//a[contains(@style, 'display: none')]")
// It gives the elements those are hidden by display: none property.
2. driver.findElement(locatorXPath).isDisplayed();
// It can throw exceptions like StaleElementException as locatorXPath is the locator for dynamic content i.e. loading icon.`
有什么方法可以创建 XPath 定位器来获取特定的可见元素?
【问题讨论】: