定位和使用单选按钮与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>

考虑到每次重新加载页面时'value'属性似乎都会改变,选择相应按钮的最佳方式是什么?

您可以使用xpath和following-sibling:

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

最新更新