如何通过Visual Basic中的webbrowser控件选择网页中的单选按钮 [英] How to select a radio button in a web page by webbrowser control in visual basic

查看:145
本文介绍了如何通过Visual Basic中的webbrowser控件选择网页中的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Visual Basic中通过webbrowser控件选择网页中的单选按钮

解决方案

这一切都取决于特定的HTML页面,因为大多数是没有编码相同。您需要单选按钮的某些属性才能找到并选择它,通常是其名称,ID或值属性。


抓取元素后,将checked属性设置为" checked"


提供此HTML:


 
< html < span style ="color:Blue;">>
< head >
< 标题 > < / 标题 >
< / head >
< ; body >
< 表格 >
选项1 < 输入 type = " radio" name = " option" id = " option1" value = < span style ="color:Blue;">" item 1"
/>
< br />
选项2 < span style ="color:Blue;">< input type = " radio" 名称 = " option" ; id = " option2" value = " ;第2项" />
< / 表格 >
< / body >
< / html >


How to select a radio button in a web page by webbrowser control in visual basic

解决方案

It all depends on the specific HTML page because most are not coded the same. You need some attribute of the radio button to be able to find and select it, usually its name, id, or value property.

Once you grab the element, you set the checked attribute to "checked"

Give this HTML:

<html>
	<head>
		<title></title>
	</head>
	<body>
	  <form>
    Option 1 <input type="radio" name="option" id="option1" value="item 1" />
    <br />
    Option 2 <input type="radio" name="option" id="option2" value="item 2" />
    </form>
	</body>
</html>


这篇关于如何通过Visual Basic中的webbrowser控件选择网页中的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆