以下是DOM中的元素。
<div style="float:left;width: 40px">
<label class="radio inline">
<input id="formData99991:Select" class="sample" data-ng-model="sampletId" size="" name="formData99991Select" sample-value="true" style="" value="1234" checked="checked" type="radio"/>
A
</label>
</div>
我尝试使用
//input[contains(@id,'formData99991:Select') and contains(text(),'A')]
,但是它不起作用。网页上有多个相似的元素,我需要用id和text的组合来标识每个元素。
最佳答案
您可以尝试使用以下x路径,
//label[contains(.,'A')]/input[@id="formData99991:Select"]
关于python - 在使用Python编写Selenium XPATH时需要帮助,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46482280/