使用 Watir,如何使用名称和值选择无线电控件?
我在函数中收到名称和状态(值),我想设置其中一个单选按钮。
我正在尝试做类似的事情,但不接受
r = $browser.input(:name => number).parent.radio :value => status
r.set
单选按钮的 html 是这样的
<input id="1" type="radio" checked="checked" value="activo" name="b1" onclick="oncheckRadio();" tabindex="7">
<input id="1" type="radio" value="inactivo" name="b1" onclick="oncheckRadio();" tabindex="8">
I receive in my function the name and the status (value) and with that i want to set one of the radio button.
I'm trying do do something like this but is not accepting
r = $browser.input(:name => number).parent.radio :value => status
r.set
the html of the radio buttons is this
<input id="1" type="radio" checked="checked" value="activo" name="b1" onclick="oncheckRadio();" tabindex="7">
<input id="1" type="radio" value="inactivo" name="b1" onclick="oncheckRadio();" tabindex="8">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我并不完全遵循此业务逻辑,但这里有一些为您提供的溯因推理(猜测)
但是,两个单选按钮都被命名为“b1”,因此按名称设置似乎有点多余。我想您指的是单选按钮的名称和状态。
I'm not entirely following the business logic of this, but here's some abductive reasoning for you (a guess)
However, both radio buttons are named "b1" so setting by name seems a little redundant. I presume you meant the name and status of the radio button.