当前位置: 首页 > 工具软件 > WatiJ > 使用案例 >

watij radio

东门俊智
2023-12-01

 Watij的文档较少。在http://watij.com/wiki:user_guide对于如何设置radio给出个例子

Radios

Watij sets or clears radios based on the name and value attributes provided in the radio HTML tag. The HTML code of a radio looks like:

Click Me: <input name="clickme" id="1" type="radio">

We can search for this radio using our Symbols

ie.radio(name,"clickme").set();
 
ie.radio(id,"1").set();
 
ie.radio(xpath, "//INPUT[@name='clickme' and @id='1']").set();

We can also use the clear method on a radio. See the Watij API for a complete list of methods available for radios

 

但是很多时候,radio相对应的html比这个例子给出的不一样,比如说像下面这个样子:

<input type="radio" name="displayMode" value="Refer"   οnclick="enselect(this.form)"  checked >引文

<input type="radio" name="displayMode" value="RefWork"  οnclick="enselect(this.form)"  >RefWork

<input type="radio" name="displayMode" value="EndNote"  οnclick="enselect(this.form)"  >EndNote

<input type="radio" name="displayMode" value="NoteExpress"  οnclick="enselect(this.form)"  >NoteExpress

<input type="radio" name="displayMode" value="new"  οnclick="enselect(this.form)"  >查新

这个radio中,光凭name是区分不出哪一个选项的,另外也没有id可用。反正就是套不上上面的例子。

那怎么写呢?

琢磨半天,发现可以这样写:

ie.radio(1).set();

数字1是编号,从0开始编号,那么radio(1).set选定的就是第二个选项RefWork了。

 

 类似资料:

相关阅读

相关文章

相关问答