Having hard time to CLICK a couple of links in a Webbrowser control!

Greek

New member
Joined
Jul 3, 2014
Messages
3
Programming Experience
10+
I made this vb.net application that among other things automates a site inside some webbrowser controls.
So I already managed to press lots of links, buttons, dialogs etc.

There is a particular page though that gives me trouble to press its links.
Here is a part of its code where the 2 links are shown

HTML:
 <img id="submissionShow:submissionTable:0:j_idt67" alt="" src="/SITE/faces/javax.faces.resource/spacer/dot_clear.gif?ln=primefaces" width="5px">

                            <a id="submissionShow:submissionTable:0:j_idt69" href="#" class="ui-commandlink" onclick="PrimeFaces.ab({formId:'submissionShow',source:'submissionShow:submissionTable:0:j_idt69',process:'@all',update:'submissionShow:errorDlgMsg',oncomplete:function(xhr, status, args){handleOpenRequest2(xhr, status, args);}});return false;">SECONDLINKTOCLICK</a><img id="submissionShow:submissionTable:0:j_idt70" alt="" src="/SITE/faces/javax.faces.resource/spacer/dot_clear.gif?ln=primefaces" width="5px">

                            <a id="submissionShow:submissionTable:0:j_idt72" href="#" class="ui-commandlink" onclick="PrimeFaces.ab({formId:'submissionShow',source:'submissionShow:submissionTable:0:j_idt72',process:'@all',update:'submissionShow:errorDlgMsg',oncomplete:function(xhr, status, args){handleOpenRequest2(xhr, status, args);}});return false;">SOMEOTHERLINK</a><img id="submissionShow:submissionTable:0:j_idt73" alt="" src="/SITE/faces/javax.faces.resource/spacer/dot_clear.gif?ln=primefaces" width="5px">

                            <img id="submissionShow:submissionTable:0:j_idt76" alt="" src="/SITE/faces/javax.faces.resource/spacer/dot_clear.gif?ln=primefaces" width="5px">

I want to click the submissionShow:submissionTable:0:j_idt67 link
and in another instance (later on the program, not after the previous link) the submissionShow:submissionTable:0:j_idt69.

(I may also have problem identify the links, because the last part after the submissionShow:submissionTable:0: changes, but lets leave that one for later)

I did many attempts but in vain. Here's my last one:

VB.NET:
   [COLOR=blue]Dim[/COLOR] Check2 [COLOR=blue]As[/COLOR] [COLOR=#2b91af]HtmlElement[/COLOR] = [COLOR=blue]Me[/COLOR].WebBrowser1.Document.GetElementById([COLOR=#a31515]"submissionShow:submissionTable:0:j_idt67"[/COLOR])

' Just wait for the element to appear
        [COLOR=blue]Dim[/COLOR] id1 [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = [COLOR=#a31515]"submissionShow:submissionTable:0:j_idt67"[/COLOR]
         [COLOR=blue]While[/COLOR] IsNothing([COLOR=blue]Me[/COLOR].WebBrowser1.Document.GetElementById(id1).InnerHtml.ToString)
            [COLOR=#2b91af]Application[/COLOR].DoEvents()
            Threading.[COLOR=#2b91af]Thread[/COLOR].Sleep(100)
        [COLOR=blue]End[/COLOR] [COLOR=blue]While[/COLOR]

' Click the element 
        Check2.InvokeMember([COLOR=#a31515]"click"[/COLOR])

Similar code works in other parts of my program but not this one.
Same for the (different kind, 67 is a transparent image?) 2nd link j_idt69
Any thoughts?
 
Last edited:
Top Bottom