0

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

1 回答 1

2

Leadfoot 有一套专门findDisplayed用于此目的的方法。这些方法将找到与查询匹配的第一个显示元素。与常规一样find,它们将等待当前的查找超时以出现匹配的元素。

this.remote
    .findDisplayedByClassName('LoginDialog')
于 2015-12-13T05:54:45.287 回答