使用页面对象按文本值单击元素

Click element by textvalue with Page Object

是否可以使用页面对象功能按值单击元素?

我以前使用过带有 Id 和 Xpath 的页面对象,但从未在内部使用过 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不经意的不存在。

有什么办法可以做到吗?

使用 xpath 表达式 检查元素的文本:

FindsBy(How = How.XPath, Using = "//span[.='FASTPRIS']")