我需要幫助撰寫一個邏輯來驗證動態文本,下面的標簽有不斷變化的文本(到 6 個唯一詞),我需要驗證這 6 個唯一詞是否與預期文本相同。有沒有辦法驗證這一點。
注意 - 單詞是以增量方式創建的,例如 - a、ap、app、appl、apple
動態文本 Html
uj5u.com熱心網友回復:
public static List<String> getDynamicText(WebDriver driver, By by, int intervalInMiliseconds, int iteration) throws InterruptedException {
List<String> collectedTexts = new ArrayList<String>();
for (int i = 1; i <= iteration; i ) {
collectedTexts.add(driver.findElement(by).getText());
Thread.sleep(intervalInMiliseconds);
}
return collectedTexts;
}
在 Java Selenium 中結合比較兩個字串的 ArrayList 以獲取其中的值
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/435278.html
標籤:javascript 爪哇 硒 硒网络驱动程序 硒化
上一篇:如何按文字點擊?
