webbrowser怎么模拟点击有id的a标签
程序代码:
using System; using System.Collections.Generic; using using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button_kaishidianji_Click(object sender, EventArgs e) { string keyword = textBox_jingjiakey.Text; webBrowser1.Document.GetElementById("kw").InnerText = keyword; webBrowser1.Document.GetElementById("su").InvokeMember("click"); for (int i = 0; i < 100000; i++) { i = i + 1; i = i - 1; } //延时,害怕网络不好 try { webBrowser1.Document.GetElementById("aw0").InvokeMember("Click"); //aw0是个a标签 } catch { MessageBox.Show("似乎木有点击成功,请重试"); } } } }