使用 watin 搜索级联元素
请告诉我如何在页面中搜索级联元素。
例如,一个页面中使用了10个锚元素标签。我可以使用 FindBy 方法(即 Element.FindBy())简单地访问一个元素。但是,当我在页面 css 上有一个级联元素(例如“.lineItem .title a”)时该怎么办
Please tell me the way to search a cascading element in a page.
For example, there are 10 anchor element tags used in a page. I can simply reach an element using FindBy method i.e. Element.FindBy(). But what to do when i have a cascading element on a page css like ".lineItem .title a"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你所说的“级联元素”是什么意思。您是否正在寻找包含在
class="lineItem"
元素中的元素,该元素包含在
class="title"
元素中代码>?如果是这样,您至少可以做两件事来查找该元素:使用
Find.ByExistenceOfRelatedElement(ElementSelector选择器)
使用
Predicate
我敢打赌还有另一种方法。
I am not sure what you mean by saying "cascading element". Are you looking for
<a/>
element contained in element withclass="lineItem"
which is contained in element withclass="title"
? If so, there is at least two things you could do, to find that element:Use
Find.ByExistenceOfRelatedElement<T>(ElementSelector<T> selector)
Use
Predicate<Link>
I bet there is another way.