无法使用
骑行(机器人框架)为以下HTML
标签选择单选按钮xpath
robotframework
中的定位器。
<Pre>
<div class="controls">
<input checked="checked" data-val="true" data-val-required="The isPdfFormat field is required." id="isPdfFormat" name="isPdfFormat" value="true" type="radio"></input> PDF
<input checked="checked" id="isPdfFormat" name="isPdfFormat" value="false" type="radio"></input> CSV
</div>
</Pre>
请检查以下路径:
//input[normalize-space(following-sibling::text())='CSV' and @id='isPdfFormat']
您可以使用此 Xpath 选择第一个单选按钮
(.//*[@class='controls']/input)[1]
如果要选择第二个,请使用此
(.//*[@class='controls']/input)[2]
如果类不是唯一的,并且匹配类的元素更多,请尝试使用 Id
(.//*[@id='isPdfFormat'])[1]