watir 的 browser.text.include 吗?计算不可见 div 内的文本?如果是这样,如何仅搜索可见文本?
watir 的 browser.text.include 吗?计算不可见 div 内的文本?如果是这样,如何仅搜索可见文本?
我从一开始就将所有说明放入 html 中,并使用 jQuery 隐藏和取消隐藏相关部分。
如何使用 watir 的 waiter 只等待可见的文本?
我的问题是,即使在我使某个文本可见之前,服务员也总是返回 true。
Does watir's browser.text.include? count text inside invisible divs? If so, how to search only for visible text?
I put all the instructions into the html from the beginning and use jQuery to hide and unhide the relevant parts.
How can I use watir's waiter to wait for only text that is visible?
My problem is, that the waiter always returns true, even before I have made visible a certain text.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要使用 Watir 的文本方法。它非常快速和肮脏,并且有很多疑虑,许多甚至与可见文本的问题无关。 Solid Watir 测试开发人员将避免它。我自己几乎从不使用它,只有当我做一些非常快速和肮脏的事情时才使用它。此外,不同的浏览器的实现方式也不同。
相反,您应该根据其所在的实际元素来访问您关心的文本。您应该引用 div 或其他内容。
Don't use Watir's text method. It is very quick and dirty, and has lots of misgivings, many not even related to this issue about visible text. Solid Watir test developers will avoid it. I almost never use it myself, and only when I am doing something extremely quick and dirty. Also, it is implemented differently with different browsers.
Instead you should access the text you care about in terms of the actual element that it is in. You should reference the div or whatever.
有什么问题
.visible 吗?在单元测试中,这是官方的,不要害怕:)
艾伦
What's wrong with:
.visible? is in the unit tests, it's official, don't be scared of it :)
Alan
include?
可以看到所有文本,而不仅仅是可见文本。有关详细信息,请参阅 WTR-433 票证。有 Element#visible? 方法不受官方支持(如据我所知)。
你想做什么?如果页面上有很多文本,并且只想显示其中的一部分,则可以将文本放在几个 div 中,然后查看 div 是否可见。
include?
sees all text, not just visible text. See WTR-433 ticket for details.There is Element#visible? method that is not officially supported (as far as I know).
What are you trying to do? If you have a lot of text on the page, and want to show only some of it, you could put the text in a few divs and then see if the div is visible.