2016-02-24 105 views
-1

我需要獲取單選按鈕的xpath。我得由這是包含在細胞第一個參數,並在選項由文本選擇合適的選擇文本此單選按鈕(禁用,啓用)獲取帶有標籤和標題作爲參數的單選按鈕的xpath

<tr cellspacing="0" width="100%"> 
<td> 
<span class="1st argument">Ctx fix: </span> 
</td> 
<td> 
<input type="radio" checked="checked" value="1"> 
<span class="second argument">Enabled</span> 
<input type="radio" value="0"> 
<span class="second argument">Disabled</span> 
</td> 
</tr> 

回答

0

您可以使用下面的XPath其中包含followingpreceding-sibling軸。

"//span[contains(text(), 'Ctx fix:')]/following::span[text()='Disabled'][1]/preceding-sibling::input[1]" 
+0

It Works,thanks! – enzr