我有4个其他元素与下面相同,但标题不同
<div id="r7695cf6b-f4a79" class="featureFoo ">
<div class="overview">
<h3 class="title">My Library</h3>
<p class="description">Some description</p>
</div>
<div class="foo">
<form>
<div id="ra41984bc58005" class="switch label-position-right non-required" aria-describedby="">
<input name="fooEnabled" type="checkbox" id="r14e560d0-bfbc-476a-a066-cbb3c043006c" checked="" class="">
<div class="foo-switch">
<div class="indicator"></div>
</div>
<span class="error" title=""></span>
</div>
</form>
</div>
</div>
我正在尝试检索非隐藏的输入元素并查看是否已选中。我有这个xpath
$x("//div[contains(@class, 'featureFoo')][./div/h3[text()='My Library']]//input[contains(@name,'fooEnabled')]")
适用于Chrome控制台,但在Ruby Cucumber的find()方法
中无效find(:xpath, "//div[contains(@class, 'featureFoo')][./div/h3[text()='My Library']]//input[contains(@name,'fooEnabled')]")
是否需要对xpath进行更多转换,以便它可以在黄瓜的find()中运行,还是可以有更好的方法呢?