wait for website to finished loading webbrowser control
Hey,well im using webbrowser control and when it submits the submit button it takes while to load then will say "loaded" on this site,the problem is it has code after and it loads b4 the site is loaded i tried using sleep but still buggy
WebBrowser1.Document.All.submit.Click
Sleep 9000
WebBrowser1.GoBack
thats what im using but it "freezes" well sleeps so it cant finish loading the site then goes bak,so basicaly i want the site to finish loading after clicking submit then go bak to the page thanks
Re: how wait for site to load
try the WebBrowser_DocumentComplete event :) also check if the document object is nothing if so then exit the event
Re: how wait for site to load
Re: how wait for site to load
Re: wait for website to finished loading webbrowser control
Re: wait for website to finished loading webbrowser control
VB Code:
Private Sub WB1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WB1.Application) Then
'code here
End If
End Sub
Re: wait for website to finished loading webbrowser control
hmm i dont understand how to use this ?
Re: wait for website to finished loading webbrowser control
thats the webborwser_documentcomplete event...
the pdisp is webbrowser... is to check to make sure the ENTIRE page is loaded...
so you code goes inside the IF statement..
chec the URL to see where u are
IF URL = "whatever.." then
Click submit...
Else
Go back
end if
kinda like that
Re: wait for website to finished loading webbrowser control
Private Sub WB1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WB1.Application) Then
WebBrowser1.Navigate "www.google.com"
End If
End Sub
Private Sub Form_Load()
If URL = "www.google.com" Then
MsgBox "hi"
Else
End If
End Sub
maybe somthing like this?but doesnt load i respect you for tryin to help
Re: wait for website to finished loading webbrowser control
hey i got it to work but this way is buggy for me any over ways?thanks
Re: wait for website to finished loading webbrowser control
like this
VB Code:
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.google.com"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print URL
If (pDisp Is WebBrowser1.Application) Then
If URL = "http://www.google.com/" Then
WebBrowser1.Document.All.q.Value = "TEST SEARCH"
WebBrowser1.Document.All.btnG.Click
Else
MsgBox "Search Results"
End If
End If
End Sub