在xpath中查找文本
如何从标签中访问“测试字段1”,而不在Xpath中使用contains或添加span标记在xpath中查找文本,xpath,Xpath,如何从标签中访问“测试字段1”,而不在Xpath中使用contains或添加span标记 <label id="138:" for="136:" class="rcmFormFieldLabel"> <span class="requiredField" aria-hidden="true" role="presentation">*</span> Testing Field 1 </label> * 试验场1 我
<label id="138:" for="136:" class="rcmFormFieldLabel">
<span class="requiredField" aria-hidden="true" role="presentation">*</span>
Testing Field 1
</label>
*
试验场1
我的xpath
//标签[contains(text(),'Testing Field 1')]/祖先::div[1]//选择
但是我的xpath包含我不想要的内容您可以使用以下xpath-1.0表达式:
//label/*/following-sibling::text()[normalize-space()]
//label/text()[normalize-space()]
Testing Field 1
您尝试过任何请求吗?您的意思是…………到目前为止您尝试过什么?//标签[contains(text(),'Testing Field 1')],但它包含了更好的内容,请将此添加到您的帖子中