Nick
Nick

Reputation: 19684

How can I progmatically click a link in a Winform Web Browser control?

I would like to know how to programatically click a link from with in a Winform Web Browser control.

 foreach (HtmlElement linkElement in webBrowser.Document.GetElementsByTagName("A"))
            {
                if(linkElement.InnerText == "Helpful Tips")
                {
                  //Click Functionality
                }

Upvotes: 1

Views: 387

Answers (1)

Garett
Garett

Reputation: 16838

You should be able to do this using the InvokeMember method. Something along these lines:

linkElement.InvokeMember("Click")

Upvotes: 1

Related Questions