是否可以使用页面对象功能按值单击元素?
我之前使用过具有Id和Xpath的Page对象,但从不使用内部html。
这是我的HTML:
<div class="col-xs-4 ng-scope">
<label class="btn btn-radio">
<input type="radio" name="product" value="5" class="hidden>
<span class="h3 text-uppercase ng-binding">FASTPRIS</span>
<small class="text-normal ng-binding">samtal</small>
</label>
</div>
正在考虑这样的事情
[FindsBy(How = How.**innerHTML**, Using = "FASTPRIS")]
public IWebElement btnFastPris { get; set; }
但innerHTML
遗忘不存在。
无论如何这可以做到吗?
答案 0 :(得分:1)
使用 xpath表达式检查元素的文本:
FindsBy(How = How.XPath, Using = "//span[.='FASTPRIS']")