2 zsrui zsrui 于 2015.07.08 11:42 提问

c# webbrowser控件中,选定radio项的问题

c# webbrowser控件中,选定radio项的问题,
做一个自动答卷的小工具,分析网页代码发现选项的文字没有写在input中,而是放在了input后面的label中,这下我怎么才能确定正确答案究竟是ABCD哪个选项呢?

 A:<input id="GridView1_ctl17_RadioButton1" type="radio" name="GridView1$ctl17$Sl" value="RadioButton1" /><label for="GridView1_ctl17_RadioButton1">A. which  </label>

B:<input id="GridView1_ctl17_RadioButton2" type="radio" name="GridView1$ctl17$Sl" value="RadioButton2" /><label for="GridView1_ctl17_RadioButton2">B. with whom  </label>

C:<input id="GridView1_ctl17_RadioButton3" type="radio" name="GridView1$ctl17$Sl" value="RadioButton3" /><label for="GridView1_ctl17_RadioButton3">C. whom  </label>

D:<input id="GridView1_ctl17_RadioButton4" type="radio" name="GridView1$ctl17$Sl" value="RadioButton4" /><label for="GridView1_ctl17_RadioButton4">D. with which</label>

1个回答

oyljerry
oyljerry   Ds   Rxr 2015.07.08 12:15

你先获取每个选项,然后得到后面label对应的字符串,然后你答题程序比较选择对应的

Csdn user default icon
上传中...
上传图片
插入图片