WebDriver:如何等待文本在元素中消失 [英] WebDriver: how to wait for text to disappear in the element
本文介绍了WebDriver:如何等待文本在元素中消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个动态更改其文本的字段.我需要一种方法来等待文本被更改.我不知道会出现什么文本,但我知道当前有什么文本.所以我想等待它在元素中消失.有办法吗?
I have a field that dynamically changes it's text. I need a way to wait for the text to be changed. I'm not aware about what text will appear, but I know what text is currently there. So i'd like to wait for it to disappear in the element. Is there a way for this?
推荐答案
你可以试试 ExpectedConditions 函数textToBePresentInElement
并添加一个not
,比如,
You can Try ExpectedConditions function textToBePresentInElement
and add a not
, like,
WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement element = driver.findElement(By.id("foo"));
wait.until(ExpectedConditions.not(
ExpectedConditions.textToBePresentInElement(element,"textToBePresent")));
这篇关于WebDriver:如何等待文本在元素中消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文