我无法选择具有唯一跨度 ID 但具有相同单选按钮类、名称、值和 ID 的单选按钮。
<td align="left" style="vertical-align: top; ">
<span class ="radiobutton" id="mainId:gen_id_12e3:radiospan1e">
<input type="radio" name="radio1" value="on" id="radio1" tabindex="0" checked>
<label for="id-2024">Yes</label>
我可以使用此代码选择跨度,但无法选择跨度内的单选按钮。
selenium.Click["css=span[id*=radiospan1e]"];
如有任何帮助,我们将不胜感激。
最佳答案
@BoltClock 说的。
selenium.Click["css=span[id*=radiospan1e] input"];
选择 ID 为 radiospan1e
的 span
,然后查找 input
子项。这是您应该学习的地方:http://www.w3.org/TR/CSS2/selector.html
关于css - 单选按钮的 CSS 选择器 selenium 代码是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9898226/