C# WebBrowser1 Click A Href - How To
I have a WebBrowser1 object. I can load page successfully. I want to click an a href element. It has to be same as user click because it executes some javascripts. How can i do that ?
Microsoft Visual Studio 2010 C# .net 4.0
开发者_运维问答Thank you.
if the element has an id
like this
<a href="http://www.yahoo.com" id="hrefId">TestLink</a>
you can do something like this.
var element = webBrowser1.Document.All["hrefId"];
if(element != null )
{
webBrowser1.Select();
element.Focus();
SendKeys.Send("{ENTER}");
}
精彩评论