Question click on hyperlink in browser - WebBrowser1.Document.Link

alekhine090

New member
Joined
Oct 26, 2013
Messages
1
Programming Experience
Beginner
Hi, Greetings to all! as I can click on a hyperlink? this is not working:

Dim IsRightElement As Boolean = False
For Each ele As HtmlElement In WebBrowser1.Document.Links
If IsRightElement Then
ele.InvokeMember("click")
IsRightElement = False
Exit For
End If
If ele.GetAttribute("class") = "rhbutton" Then
IsRightElement = True
End If
Next

html code (added XXX on end and begining):

XXX<a class="rhbutton" title="OLX.com.ve" target="_top" href="http://www.googleadservices.com/pagead/aclk?sa=L&ai=CpfBtTHFsUorlOOPS0AHG6YCADdKanPMDup2f3l3AjbcBEAEg-sSpIlDf4vjIAWDfBqABzuz41QPIAQGoAwHIA9MEqgSpAU_QnD-nJ7Uu6lZ0mhbr47Mhba_uTxEl1sL5nXH2hqmtwOVcMIGCFxuoBGkrJeQWPuvlw_XYJ8KZ4hoLs8c2vnBsOdEYJWB53Lkh361-DI6qnDyna1kD2nahUkQVFrJFbLA02hKoVEAjsSaYlPqtJaW0DE5LHIoehsoKZLJzy80FIbeeLPzjdYGdiJROojfIsU5QKmeegwz_STBmlXiesYSiJu3EjeimNLKIBgGAB5qThyo&num=1&cid=5GjQiW_zI-voJ0bLZv1Vi-1B&sig=AOD64_3UIxmtslHsre1Oxp8O41TYP6CVrQ&client=ca-pub-7491432451285500&adurl=http://k.keyade.com/kack/1/%3FkaPt%3Dgoogle%26kaTckM%3Dp%26kaPcId%3D98678%26kaTckId%3D25801557650%26kaAcId%3D155%26kaCpnId%3D%26kaNtw%3Dcontent%26kaKwd%3Dventas%2520camionetas%2520pickup%26kaDmn%3Dwww.decorationsnailart.com%26kaTgt%3D%26kaNtw2%3Dd%26kaMtTp%3D%26kaAdPos%3Dnone%26kaDev%3Dc">

<img src="http://pagead2.googlesyndication.com/pagead/images/nessie_icon_chevron_white.png" alt=""></img>

</a>XXX
 
Hi alekhine090, please wrap your cod in code tags:

[CODE][/CODE]

or

[XCODE=vb.net][/XCODE]

I didn't test out your code, but by just looking at it I think that I can tell what's going on. You set IsRightElement after you check if it's true or false. Switch the order of your conditional statements and it should work a bit better.
 

Latest posts

Back
Top