我正在尝试测试我的应用程序的登录对话。需要等待一个类名为"LoginDialog“的元素被添加到DOM中。但是,该对话框不会立即出现在UI上,尽管它仍然会立即添加到DOM中。我需要确定它是否也是可见的。
我决定首先使用pollUntil添加元素,然后使用isdiplayed检查元素是否显示,但我仍然得到元素无可见错误
.then(pollUntil('return document.getElementsByClassName("LoginDialog", 8000)'))
.findAllByXpath("//div[contains(@class, \'LoginDialog\')]")
.isDisplayed()
.then(function(bool) {
debugger;
if (!bool[0]) {
this.then(pollUntil('return document.getElementsByClassName("LoginDialog", 8000)'))
//not sure about this step too. i need to wait until the element is diplayed on the UI
}
}).end()发布于 2015-12-13 13:54:45
Leadfoot为此提供了一组findDisplayed方法。这些方法将查找与查询匹配的第一个显示元素。与常规的find一样,它们会一直等到当前的查找超时,直到出现匹配的元素。
this.remote
.findDisplayedByClassName('LoginDialog')https://stackoverflow.com/questions/33876698
复制相似问题