【发布时间】:2016-06-01 09:14:16
【问题描述】:
我正在使用此代码查找匹配的文本,我想查找重复记录
WebElement body = driver.findElement(By.tagName("body"));
String bodyText = body.getText();
// count occurrences of the string
int count = 0;
// search for the String within the text
while (bodyText.contains("VIM LIQUID MARATHI")){
// when match is found, increment the count
count++;
// continue searching from where you left off
bodyText = bodyText.substring(bodyText.indexOf("VIM LIQUID MARATHI") + "VIM LIQUID MARATHI".length());
}
【问题讨论】:
-
这对我来说很清楚,但是我的 qyuestoin 是,现在我正在指向一个网页,它包含 n 个文本,我怎么能找到该网页包含重复的文本,,,,说将显示/列出的文本(Zebra)翻页 2 次,它应该发现 zebra 是重复的,就像我想要上述场景的脚本一样
标签: javascript java selenium