【问题标题】:Intern leadfoot (element not visible) : Wait till element is visible using isDisplayed?实习生leadfoot(元素不可见):等到元素使用isDisplayed可见?
【发布时间】:2015-11-23 17:12:13
【问题描述】:

我正在尝试测试我的应用程序的登录对话框。需要等待一个类名为“LoginDialog”的元素被添加到 DOM。但是,对话框不会立即出现在 UI 上,尽管它仍会立即添加到 DOM 中。我需要确定它是否也可见。

我决定先轮询直到元素被添加,然后检查元素是否使用 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()

【问题讨论】:

    标签: intern leadfoot


    【解决方案1】:

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

    this.remote
        .findDisplayedByClassName('LoginDialog')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-05
      • 1970-01-01
      • 2016-07-18
      • 2020-11-22
      相关资源
      最近更新 更多