等待直到文本字段中的文本存在 [英] Wait Till Text Present In Text Field

查看:134
本文介绍了等待直到文本字段中的文本存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在webdriver中,如何要求webdriver等到文本字段中存在文本。

In webdriver, how to ask to webdriver to wait until text is present in text field.

实际上我有一个kendo文本字段,其值来自数据库加载一段时间。一旦加载,我就可以继续进行。

actually i have one kendo text field whose values comes from database which takes some time to load. Once it load i can proceed further.

请帮忙解决这个问题

推荐答案

您可以使用WebDriverWait。来自docs示例:

You can use WebDriverWait. From docs example:

 (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
            public Boolean apply(WebDriver d) {
                return d.findElement(...).getText().length() != 0;
            }
        });

这篇关于等待直到文本字段中的文本存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆