For example I have this html code:
<a href="#" onclick="return Index.submit_login('server_pl80');">
<span class="world_button_active">Świat 80</span>
</a>
And I need to get attribute of onclick, because I may get more links and I must find difference between them. For my opinion get attribute of onclick is only one way. But if I GetAttribute("onclick") from HTMLElement it will return System.__ComObject.
Is there any idea how read onclick value from webBrowser?
I have only this:
HtmlElement selected_div = @webBrowser1.Document.GetElementById("div_id").GetElementsByTagName("div")[0];
HtmlElement a = selected_div.GetElementsByTagName("a")[0];
string rightLink = a.GetAttribute("href");
string onclickLink = a.GetAttribute("onclick"); // return "System.__ComObject" string
if (rightLink == "http://www.example.com/#")
a.InvokeMember("click", null);
"onclick" or "onClick" in getAttribute(); doesn't make a difference
This code works but click on first link on the list of servers.. I need choose the server and links have difference only in onclick attribute.