Jump to content

IE automation failing to get forms from a frame


jrumbaug
 Share

Go to solution Solved by jrumbaug,

Recommended Posts

An IE program that I have been using for over a year has started failing. I have traced the problem to this code snipet.  

The errors happens when I try to get a FORM object from a FRAME object. The message box reports that the $oFrame is an object, but the  error says [  Variable must be of type "Object" ]

Local $iNumFrames

$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
For $i = 0 to ($iNumFrames - 1)
            $oFrame = _IEFrameGetCollection ($oIE, $i )
            msgBox(1,  " var type " & VarGetType( $oFrame) ,  @error )
            $oForms  = _IEFormGetCollection ($oFrame)
Next

The reported errors are:

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

Return SetError($_IEStatus_Success, $oTemp.forms.length, $oTemp.forms)

Return SetError($_IEStatus_Success, $oTemp^ ERROR

->11:15:29 AutoIt3.exe ended.rc:1

+>11:15:29 AutoIt3Wrapper Finished..

>Exit code: 1    Time: 17.812

 

Thank you in advance for suggestions.

Jim Rumbaugh

Link to comment
Share on other sites

maybe instead of $oTemp.forms.length

try

$oTemp.frames.length

As you said it yourself, its a frame not a form. :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

  • Moderators

I remember reading that too Dan, do you remember the post or the actual update they removed?  Really wish I had that environment to test in.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

This >thread is the one where they identified the problematic update.

Indeed, kb3025390 update seems to be an issue for any and all automation products out there.

Thanks

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Solution

Thank you for pointing me to the other thread. My problem was also solved by what I read:

"Thanks everyone for extremely helpful responses, the problem is "solved" by uninstalling KB3025390 IE update."

The only insight I can add that may help a workaround for use WITH the update:

one program worked that began with:
$oIE = _IECreateEmbedded ()
The program that began with this had the errors:
$oIE = _IECreate ("http://www.hhcwv.com/")
Edited by jrumbaug
Link to comment
Share on other sites

although marked answered.

interesting just tried it from Excel VBA to see if there is something not revealed (on my system KB3025390 is installed)

Sub test()
    Dim shW As New SHDocVw.ShellWindows
    Dim myIE As InternetExplorer
    Dim myDoc As HTMLDocument
    
    
    Debug.Print shW.Count
    
    Set myIE = shW.Item(0)
    Debug.Print myIE.Name
 
Set myDoc = myIE.document
    
    Debug.Print myIE.LocationURL
    Debug.Print myDoc.frames.Length
    Debug.Print myDoc.parentWindow.frames.Length
    Debug.Print myDoc.forms.Length
End Sub
 
  

    

output

1 
Internet Explorer
http://www.hhcwv.com/
 3
 3 
 0
so the frames are returned properly and as vba is telling there are 0 forms its correct you do not get an object

 

maybe rewrite in IE.AU3 (at least you will not get the error as you had)

; #FUNCTION# ====================================================================================================================
; Author ........: Dale Hohm
; ===============================================================================================================================
Func _IEDocGetObj(ByRef $oObject)
    If Not IsObj($oObject) Then
        __IEConsoleWriteError("Error", "_IEDocGetObj", "$_IESTATUS_InvalidDataType")
        Return SetError($_IESTATUS_InvalidDataType, 1, 0)
    EndIf
    ;
    If __IEIsObjType($oObject, "document") Then
        Return SetError($_IESTATUS_Success, 0, $oObject)
    EndIf

    local $oTemp
    $oTemp=$oObject.document

    If __IEIsObjType($oTemp, "document") Then
        Return SetError($_IESTATUS_Success, 0, $oTemp)
    Else
        Return SetError($_IESTATUS_InvalidObjectType, 1, 0)
    EndIf

EndFunc   ;==>_IEDocGetObj
or write this

$oForms  = _IEFormGetCollection ($oDoc)
but for sure this patch of microsoft gives problems

 

http://stackoverflow.com/questions/27566985/browser-execscript-stopped-working-after-updating-windows

So far I do not have problems with IUIAutomation framework references and simplespy in examples section running against IE.

Edited by junkew
Link to comment
Share on other sites

  • Moderators

execScript was to be deprecated in IE - 11, I made note of this in IEJS.au3.

http://msdn.microsoft.com/en-us/library/ie/ms536420%28v=vs.85%29.aspx

Edit:

Not that anyone would know I made note, I meant to add that I have a work around for it.

Edit2:

Ok, time for bed, I don't have a work around for KB3025390, my work around is for execScript deprecation.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

×
×
  • Create New...