【发布时间】:2011-12-21 13:33:56
【问题描述】:
如何仅通过指定文本属性来定位元素,无论是链接还是按钮或其他内容。
在jquery中,我们可以这样写:
$('*').filter(function(){return $(this).text()=="some text";});
如何在 Watir 中实现相同的目标?
【问题讨论】:
标签: automation automated-tests watir watir-webdriver
如何仅通过指定文本属性来定位元素,无论是链接还是按钮或其他内容。
在jquery中,我们可以这样写:
$('*').filter(function(){return $(this).text()=="some text";});
如何在 Watir 中实现相同的目标?
【问题讨论】:
标签: automation automated-tests watir watir-webdriver
如果你不知道元素类型,但你知道它的属性(在你的情况下是文本):
browser.element(:text => "some text")
【讨论】: