Sign in to follow this  
Followers 0
MuffettsMan

_IEBodyReadText Error: IE.au3 (2143) : ==> Variable must be of type "Object".:

6 posts in this topic

I have been working on this script for weeks and all of the sudden started getting an error this morning:

C:\Program Files\AutoIt3v3.2.8.1\Include\IE.au3 (2143) : ==> Variable must be of type "Object".:

Return $o_object.document.body.innerText

Return $o_object.document.body^ ERROR

->06:59:30 AutoIT3.exe ended.rc:1

+>06:59:31 AutoIt3Wrapper Finished

looked up the IE include and verified it is refering to the _IEBodyReadText function...

;===============================================================================
;
; Function Name:    _IEBodyReadText()
; Description:      Returns the Text inside the <body> tag of the document
; Parameter(s):     $o_object   - Object variable of an InternetExplorer.Application, Window or Frame object
; Requirement(s):   AutoIt3 V3.2 or higher
; Return Value(s):  On Success  - Returns the Text included in the <body> of the docuement
;                   On Failure  - Returns 0 and sets @ERROR
;                   @ERROR      - 0 ($_IEStatus_Success) = No Error
;                               - 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
;                   @Extended   - Contains invalid parameter number
; Author(s):        Dale Hohm
;
;===============================================================================
;
Func _IEBodyReadText(ByRef $o_object)
    If Not IsObj($o_object) Then
        __IEErrorNotify("Error", "_IEBodyReadText", "$_IEStatus_InvalidDataType")
        SetError($_IEStatus_InvalidDataType, 1)
        Return 0
    EndIf
    If Not __IEIsObjType($o_object, "browserdom") Then
        __IEErrorNotify("Error", "_IEBodyReadText", "$_IEStatus_InvalidObjectType", "Expected document element")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
    ;
    SetError($_IEStatus_Success)
    Return $o_object.document.body.innerText
EndFunc   ;==>_IEBodyReadText

at this point all i can guess is some variable isn't being declared correctly >.<


Don't let that status fool you, I am no advanced memeber!

Share this post


Link to post
Share on other sites



example of my code thats causing the crash...

; *******************************************************
; Dump Error Log files Function....
; Will create a Error file 
; *******************************************************
Func DumpError($func, $source)
    $ErrorLogFile = $DebugDir & "\CMS_Error_" & $func & ".txt" ; use date functions here...
    $errorfile = FileOpen($ErrorLogFile, 1) ; 1 = Write mode (append to end of file) FileClose($logfile)
    ; Check if file opened for writing OK
    If $logfile = -1 Then
            MsgBox(0, "Error", "Unable to open file: " & $ErrorLogFile)
            Exit
    EndIf
    FileWrite($errorfile, Timestamp() & $func & "Source: " & @CRLF)
    FileWrite($errorfile, $source)
    FileClose($errorfile)
EndFunc

; example of call to the function
;...

    if $CMS_Login_Status == 0 Then
        ; TrayTip("CMS EnableUser", "Failed to login to CMS after 5 attempts... Ending Enable User Function." & $User, 5, 1)
        FileWrite($logfile, Timestamp() & "CMS EnableUser - Failed to login to CMS after 5 attempts... Creating error log snapshot." & @CRLF)
        $source = _IEBodyReadText ($oIE)
        DumpError($func, $source)
        DumpLog() ; Write to all log files
        return 0
    EndIf

Don't let that status fool you, I am no advanced memeber!

Share this post


Link to post
Share on other sites

example of my code thats causing the crash...

I don't see where you create the $oIE object, or verify it is valid.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

example of my code thats causing the crash...

_IEErrorHandlerRegister() will giver you more data to the console and will allow you continue past the error.

I only check to see if $oIE is an object, but don't insure it is the right type of object... so writing out ObjName($oIE) would be useful. Also, another likely cause is navigating to something like a pdf file that activates a browser plugin that does not offer the same object model.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

_IEErrorHandlerRegister() will giver you more data to the console and will allow you continue past the error.

I only check to see if $oIE is an object, but don't insure it is the right type of object... so writing out ObjName($oIE) would be useful. Also, another likely cause is navigating to something like a pdf file that activates a browser plugin that does not offer the same object model.

Dale

I am having the same issue. See attachment.

The page I am reading from self refresh each 15 sec. The problem occurs while the web page is self reloading.

BobTheVeg

post-36473-1212948108_thumb.jpg

post-36473-1212948119_thumb.jpg

Share this post


Link to post
Share on other sites

Try adding _IELoadWait($oIE) prior to the offending call. The document object is destroyed duing a refresh and recreated when it is done. Issueing a call during the refresh that assumes that the document is valid will result in this sort of an error. With _IEErrorHandlerRegister() in play, you can also check @error to see if it tells you a COM error occurred and then retry your function.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0