使用WebDriver定位和使用单选按钮

时间:2014-05-15 15:10:37

标签: html selenium selenium-webdriver webdriver

给出以下HTML:

<td>
<input type="hidden" value="" name="chosenstepid">
<input type="radio" value="1355816110363,1324313696089,full" name="ChooseStep">
Click here to send forward 
<br>
<input type="hidden" value="432000000" name="Step0">
<input type="radio" value="1355816110363,1324312435553,full" name="ChooseStep">
Click here to send backwards
<br>
<input type="hidden" value="432000000" name="Step1">
</td>

选择相应按钮的最佳方式是什么,假设&#39;值&#39;每次重新加载页面时,属性似乎都会改变。

1 个答案:

答案 0 :(得分:0)

您可以使用xpath和following-sibling

//input[@name='chosenstepid']/following-sibling::input[1]
//input[@name='Step0']/following-sibling::input[1]