Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Selenium Builder 进行 Selenium 测试。我想检查网站上是否有一些重复的内容。它可以是文本“这是一个示例”或 div ids “#id_to_catch”。我怎样才能做到这一点?
通过使用findElements函数:
Boolean dups = (driver.findElements(By.xpath("//*[contains(.,'This is an example')]")).size()>1);