Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automate logon
Message
From
25/03/2009 13:43:21
 
General information
Forum:
Internet
Category:
Other
Title:
Miscellaneous
Thread ID:
01391329
Message ID:
01391448
Views:
42
Using that code from Wiki I still get Member Document does not evaluate to an object.




>>>For me it opens UT, then gives me an error (Member Forms doesn't evaluate to an object) on this line
>>>
>>>* Fill in one of the forms
>>>loIE.Document.Forms("login").Username.Value = "foo"
>>>
>>>May be the name of the form has changed since that code has been written.
>>
>>Form1 is the name of the form.
>
>Using this code
>
>#define CR CHR(13)
>
>LOCAL ;
>	loIE as InternetExplorer.Application, ;
>	llSuccess as Logical, ;
>	x as String
>
>* Create an instance of IE
>loIE = CREATEOBJECT("InternetExplorer.Application")
>loIE.Visible = .T.
>
>* Tell IE to load a page
>llSuccess = loIE.Navigate("http://www.levelextreme.com")
>
>* Wait for IE to do it
>llSuccess = lWait( loIE )
>
>* Show the names of the forms:
>x = "Forms:"
>For lnForm = 0 to loIE.Document.forms.length - 1
>	x = x + TRANSFORM(lnForm) + ": " + TRANSFORM(loIE.Document.forms(lnForm).name)
>EndFor
>x = x + CR
>
>* Fill in one of the forms
>loIE.Document.Forms("Form1").Username.Value = "foo"
>loIE.Document.Forms("Form1").Password.Value = "bar"
>loIE.Document.Forms(0).Submit()
>llSuccess = lWait( loIE )
>
>* Look at all of the objects.
>* all(0) represents everything,
>* 1-N are contained objects some of which are containers themselves,
>* so the same thing may apear in different .all(x)'s
>x = x + "All Objects:"
>For lnObj = 0 to loIE.Document.all.length - 1
>	loObj = loIE.Document.all( lnObj )
>	x = x + TRANSFORM(lnObj) + ": " + TRANSFORM(Substr(loObj.innerhtml, 1, 20))
>	x = x + TRANSFORM(loObj.TagName) + ": " + TRANSFORM(loObj.innertext)
>EndFor
>
>* Close IE.
>* You can leave it open, doesn't seem to be a problem,
>* unless .visible=.f. then it is harder to close cuz you cant see the X.
>loie.Quit
>
>* save and display results
>STRTOFILE(x, "WebResult.txt")
>MODIFY FILE WebResult.txt NOWAIT
>Return
>
>
>
>******************************
>Function lWait( toIE )
>* Wait for IE to process what you told it too.
>* There has got to be a simpler way to do this.
>
>DECLARE Sleep IN Win32API INTEGER nMilliseconds
>
>Local ;
>	ltStartTime, ;
>	ltTimeOut, ;
>	lcCheckThis, ;
>	llRet
>
>ltStartTime = Datetime()
>ltTimeOut = ltStartTime + 60
>
>DO WHILE (Datetime() < ltTimeOut ) ;
>	AND type( "toIE.document" ) <> "O"
>	=Sleep(1000)
>EndDo
>DO WHILE (Datetime() < ltTimeOut ) ;
>	AND toIE.busy
>	=Sleep(1000)
>ENDDO
>DO WHILE (Datetime() < ltTimeOut ) ;
>	and type( "toie.document.readystate" ) <> "C"
>	=Sleep(1000)
>ENDDO
>DO WHILE (Datetime() < ltTimeOut ) ;
>	and toie.document.readystate <> "complete"
>	=Sleep(1000)
>ENDDO
>
>llRet = Datetime() < ltTimeOut
>If !llREt
>	toie.Stop()
>EndIf
>
>RETURN llRet
>
>* EOF
>
>
>It did work.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform