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?
推荐答案
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屋!
查看全文