Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Programatically clicking links in WebBrowser control

Status
Not open for further replies.

DaviiD2010

Programmer
Apr 25, 2010
12
NL
Hi all i have html page loaded in to my webbrowser controle that looks like this:
Code:
   <a href="[URL unfurl="true"]http://www.somesite.com/recordds.wmt?page=31"[/URL] title="Go to Next Page" onfocus="if(this.blur)this.blur();"
>  next &raquo;</a>
I used the following codes to click on it but it doesn't work . could you guys tell me what i am doing wrong ? Thanks

Code:
Private Sub Command8_Click()
For Each ele In WebBrowser1.Document.getelementsbytagname("a")
If ele.innertext = " next &raquo;" Then ele.Click
Next
End Sub

or

Code:
Private Sub Command8_Click()
For Each ele In WebBrowser1.Document.getelementsbytagname("a")
If ele.innertext = "next" Then ele.Click
Next
End Sub
 
[tt]If Instr(1, ele.innertext, "next", vbTextCompare) > 0 Then ele.Click[/tt]



Good Luck

 
thanks vb5progrmr that worked well is it possible that get the url of that next page as well ?
 
Before you navigate you should be able to use ele.href and after you should be able to use the document complete event??? I think??? or when it fires when it is done, wb.document.url or href...



Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top