首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >实习生leadfoot (元素不可见):使用isDisplayed等待元素可见?

实习生leadfoot (元素不可见):使用isDisplayed等待元素可见?
EN

Stack Overflow用户
提问于 2015-11-24 01:12:14
回答 1查看 620关注 0票数 0

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

我决定首先使用pollUntil添加元素,然后使用isdiplayed检查元素是否显示,但我仍然得到元素无可见错误

代码语言:javascript
复制
.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()
EN

回答 1

Stack Overflow用户

发布于 2015-12-13 13:54:45

Leadfoot为此提供了一组findDisplayed方法。这些方法将查找与查询匹配的第一个显示元素。与常规的find一样,它们会一直等到当前的查找超时,直到出现匹配的元素。

代码语言:javascript
复制
this.remote
    .findDisplayedByClassName('LoginDialog')
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33876698

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档