我正在尝试测试我的应用程序的登录对话。需要等待一个类名为“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()