1
2
3
4
5
6
| private void Form1_Load( object sender, EventArgs e) { webBrowser1.Navigate( "deineWebsite" ); webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted); } |
1
| < a onclick = "alert('Link geklickt')" id = "link" >Bitte klicken</ a > |
1
2
3
4
5
|
void webBrowser1_DocumentCompleted( object sender, WebBrowserDocumentCompletedEventArgs e) { webBrowser1.Document.GetElementById( "link" ).InvokeMember( "click" ); } |
1
2
3
4
5
6
7
8
9
10
11
| void webBrowser1_DocumentCompleted( object sender, WebBrowserDocumentCompletedEventArgs e) { HtmlElementCollection htmlElements = webBrowser1.Document.GetElementsByTagName( "a" ); foreach (HtmlElement item in htmlElements) { if (item.InnerText.Contains( "Bitte klicken" )) { item.InvokeMember( "click" ); } } } |