使用Selenium Builder检查重复的内容

时间:2017-05-10 13:12:15

标签: selenium selenium-webdriver selenium-builder

我使用Selenium Builder进行Selenium测试。我想检查网站上是否有一些重复的内容。它可以是文本“这是一个例子”或div ids“#id_to_catch”。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

使用 findElements 功能:

Boolean dups = (driver.findElements(By.xpath("//*[contains(.,'This is an example')]")).size()>1);