-
webbrowser problem
Code:
WebBrowser1.Navigate "http://abc.com"
Do While WebBrowser1.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
WebBrowser1.Document.All("username").Value = "admin"
WebBrowser1.Document.All("clickbutton").clicked
WebBrowser1.Navigate "http://xyz.com"
Do While WebBrowser1.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
WebBrowser1.Document.All("username").Value = "admin"
WebBrowser1.Document.All("clickbutton").clicked
I want to login in two sites on a single command button click event and the problem is that as soon this command run
WebBrowser1.Document.All("clickbutton").clicked
it execute next line either the previous line is succesffully executed or not......
-
Re: webbrowser problem
maybe you need to wait for readystate complete again, before navigating to next page
-
Re: webbrowser problem
i have tried but not working
-
Re: webbrowser problem
You should use the _DocumentComplete Event to do what you want
Code:
Dim NoReEntry1 As Boolean
Dim NoReEntry2 As Boolean
'
'
Private Sub Command1_Click()
WebBrowser1.Navigate "http://abc.com"
End Sub
Private Sub WebBrowser1_DocumentComplete(....., URL As Variant)
If URL = "http://abc.com" Then
If NoReEntry1 <> True Then
NoReEntry1 = True
WebBrowser1.Document.All("username").Value = "admin"
WebBrowser1.Document.All("clickbutton").clicked
WebBrowser1.Navigate "http://xyz.com"
End If
End If
If URL = "http://xyz.com" Then
If NoReEntry2 <> True Then
NoReEntry2 = True
WebBrowser1.Document.All("username").Value = "admin"
WebBrowser1.Document.All("clickbutton").clicked
End If
End If
End Sub
-
Re: webbrowser problem
Code:
Dim NoReEntry1 As Boolean
Dim NoReEntry2 As Boolean
Private Sub Command1_Click()
web1.Navigate "http://abc.com"
web1.Navigate "http://xyz.com"
End Sub
Private Sub web1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If URL = "http://abc.com" Then
If NoReEntry1 <> True Then
NoReEntry1 = True
WebBrowser1.Navigate "http://abc.com"
End If
End If
If URL = "http://xyz.com" Then
If NoReEntry2 <> True Then
NoReEntry2 = True
WebBrowser1.Navigate "http://xyz.com"
End If
End If
End Sub
as soon as i run this code it is not showing me http://abc.com it direct go to xyz.com
i want that firstly abc.com totally load in webbrowser and after that xyz.com load in webbrowser
-
Re: webbrowser problem
You are really making a mess out of this. You cannot navigate to two different sites in the same Command event like you are doing.
What you are trying to do isn't going to work because as soon as abc.com loads you turn right around and load xyz.com. You know the browser cannot show two sites at the same time. You need to load abc.com and pause it for awhile (use some kind of timing method or set a switch as to when it is OK to load xyz) before you load xyz.com. At least wait until your login has finished with abc before you navigate to xyz.
What you are doing is like clicking on a link and then click on another link at the flash of an eye.