gpt4 book ai didi

selenium-webdriver - WebDriver:如何等待文本在元素中消失

转载 作者:行者123 更新时间:2023-12-01 04:35:37 25 4
gpt4 key购买 nike

我有一个动态更改其文本的字段。我需要一种方法来等待文本被更改。我不知道会出现什么文本,但我知道当前那里有什么文本。所以我想等待它在元素中消失。有办法吗?

最佳答案

你可以试试ExpectedConditions函数 textToBePresentInElement 并添加一个 not,比如,

WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement element = driver.findElement(By.id("foo"));
wait.until(ExpectedConditions.not(
ExpectedConditions.textToBePresentInElement(element,"textToBePresent")));

关于selenium-webdriver - WebDriver:如何等待文本在元素中消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35461228/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com