سؤال

$aArray = _IEFrameGetCollection($ObjIE)
$max = @extended
ConsoleWrite("Array Length: " & $max & @CR)
For $item in $aArray
    ConsoleWrite("Value" & $item.src)
Next

The code causes the following error:

--> COM Error Encountered in ITSM-GUI-Automation.au3
----> $IEComErrorScriptline = 106
----> $IEComErrorNumberHex = 80020003
----> $IEComErrorNumber = -2147352573
----> $IEComErrorWinDescription = Member not found.
----> $IEComErrorDescription =
----> $IEComErrorSource =
----> $IEComErrorHelpFile =
----> $IEComErrorHelpContext = 0
----> $IEComErrorLastDllError = 0

The weird thing is that $max is getting set to 3 but then it cannot find the iframes. How can it find it and immediately not find it?

هل كانت مفيدة؟

المحلول

This is because of my lack of understanding of the Autoit objects. This does not return an array of objects but a collection which must be accessed through a different way.

Hope this helps someone else.

$collection = _IEFrameGetCollection($ObjIE)
$max = @extended
ConsoleWrite("Array Length: " & $max & @CR)
For $item = 0 to $max - 1
    $obj = IEFrameGetCollection($ObjIE, $item)
    ConsoleWrite("Value" & $item.src)
Next

نصائح أخرى

#include <IE.au3>

Local $oIE = _IE_Example("frameset")
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
For $i = 0 To ($iNumFrames - 1)
    Local $oFrame = _IEFrameGetCollection($oIE, $i)
    $FrameHTML = _IEDocReadHTML($oFrame); or
    $FrameHTML = _IEPropertyGet($oFrame, "innerhtml"); or
    $FrameHTML = _IEPropertyGet($oFrame, "outerhtml")
    ConsoleWrite($FrameHTML & @LF)
Next
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top