WebBrowser Control (1 Viewer)

Davef28

Registered User.
Local time
Today, 18:43
Joined
Feb 6, 2002
Messages
51
I have the following code which displays the correct URL, and populates the fields, when going thru in debug mode but loops when running normally. Somehting simple I guess but I cannot see it.

Private Sub Command1_Click()

Me!WebBrowser0.Navigate "https://www.lexisnexis.com/PowerInvoice"
Loop1:
If Me!WebBrowser0.ReadyState = READYSTATE_COMPLETE Then
Me!WebBrowser0.Document.signinForm.webid.Value = "????"
Me!WebBrowser0.Document.signinForm.Password.Value = "????"
Else
GoTo Loop1
End If
End Sub
 

Fear Naught

Kevin
Local time
Today, 18:43
Joined
Mar 2, 2006
Messages
229
You are testing for the READYSTATE value to be READYSTATE_COMPLETE but nothing actually sets it to this therefore your code will continue looping.

I admit I know very little about webbrowser coding structures but I wuld imagine your code needs to be something like:

Code:
Private Sub Command1_Click()

Me!WebBrowser0.Navigate "https://www.lexisnexis.com/PowerInvoice"
Loop1:
If Me!WebBrowser0.ReadyState = READYSTATE_COMPLETE Then
Me!WebBrowser0.Document.signinForm.webid.Value = "????"
Me!WebBrowser0.Document.signinForm.Password.Value = "????"
[COLOR="Red"]Me!WebBrowser0.ReadyState = READYSTATE_COMPLETE[/COLOR]
Else
GoTo Loop1
End If
End Sub

HTH but I would be keen to know how you solve it if my solution is not correct.
 

Davef28

Registered User.
Local time
Today, 18:43
Joined
Feb 6, 2002
Messages
51
READYSTATE_COMPLETE is a special register (not sure if thats the correct name) and gets set once the page has loaded. The If statement does work because I can see the code going thru the loop.
 

Davef28

Registered User.
Local time
Today, 18:43
Joined
Feb 6, 2002
Messages
51
I still need an answer for this, sorry for promoting post to top again, really by tomorrow morning UK time.


thanks
 

RuralGuy

AWF VIP
Local time
Today, 11:43
Joined
Jul 2, 2005
Messages
13,825
How about going through the Document collection?
If Me!WebBrowser0.Document.ReadyState = READYSTATE_COMPLETE Then

I looked at the WebPage and could not see anything called ReadyState. Good Luck.

Maybe you should be looking for a string!
If Me!WebBrowser0.ReadyState = "READYSTATE_COMPLETE" Then
 

Users who are viewing this thread

Top Bottom