需要使用Python为Selenium编写XPATH的帮助吗
下面是DOM中的元素需要使用Python为Selenium编写XPATH的帮助吗,python,selenium,Python,Selenium,下面是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
<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>
A.
我尝试了//input[contains(@id,'formData99991:Select')和contains(text(),'A')]
,但不起作用。
网页上有多个类似的元素,我需要用id和文本组合来标识每个元素。您可以尝试使用以下x路径
//label[contains(.,'A')]/input[@id="formData99991:Select"]
你能分享你的html代码吗?我把它贴在问题上了。但是,它没有出现在这里..请在下面找到一个为什么不使用firepath for firebug以便检查元素,它们直接为您提供正确的xpath?