我要实现
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.xpath("//div[@id='timeLeft']"), "Time left: 7 seconds"));
C# 中的函数,用于等待文本出现。但是,textToBePresentInElementLocated()
仅在 java 中可用。有没有一种简单的方法可以在 c# 中实现这一点,等待文本出现在页面上?
最佳答案
我能够通过以下方式解决此问题:
element = driver.FindElement(By.Xpath("//div[@id='timeLeft']")));
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(ExpectedConditions.TextToBePresentInElement(name, "Time left: 7 seconds"));
关于c# - Selenium webdriver c# 等待文本出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25976068/