Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要使用Python为Selenium编写XPATH的帮助吗_Python_Selenium - Fatal编程技术网

需要使用Python为Selenium编写XPATH的帮助吗

需要使用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

下面是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>

A.
我尝试了
//input[contains(@id,'formData99991:Select')和contains(text(),'A')]
,但不起作用。
网页上有多个类似的元素,我需要用id和文本组合来标识每个元素。

您可以尝试使用以下x路径

//label[contains(.,'A')]/input[@id="formData99991:Select"]

你能分享你的html代码吗?我把它贴在问题上了。但是,它没有出现在这里..请在下面找到一个为什么不使用firepath for firebug以便检查元素,它们直接为您提供正确的xpath?