vb的WebBrowser里打开页面后,要点击一个按钮,如何实现,请指教!
1个回答
展开全部
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
foreach (HtmlElement el in webBrowser1.Document.All)
{
el.Click += new HtmlElementEventHandler(el_Click);
}
}
void el_Click(object sender, HtmlElementEventArgs e)
{
HtmlElement el = (HtmlElement)sender;
if (el.TagName.ToUpper() == "INPUT")
{
string s = "Name:" + el.GetAttribute("name") + "\r\n";
s += "ID:" + el.GetAttribute("id") + "\r\n";
s += "Type:" + el.GetAttribute("type");
MessageBox.Show(s);
}
}
========================
还有其他的属性都可以通过这个方法获得
{
foreach (HtmlElement el in webBrowser1.Document.All)
{
el.Click += new HtmlElementEventHandler(el_Click);
}
}
void el_Click(object sender, HtmlElementEventArgs e)
{
HtmlElement el = (HtmlElement)sender;
if (el.TagName.ToUpper() == "INPUT")
{
string s = "Name:" + el.GetAttribute("name") + "\r\n";
s += "ID:" + el.GetAttribute("id") + "\r\n";
s += "Type:" + el.GetAttribute("type");
MessageBox.Show(s);
}
}
========================
还有其他的属性都可以通过这个方法获得
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询