Sign in to follow this  
Followers 0
lfast

_ IEFormGetCollection internal failure

11 posts in this topic

Hi Folks,

I'm a nubie trying to get my feet wet with the _IE.au3 library. I'm following the _IEFormGetCollection sample code to the letter but getting an internal error. Any guesses? Or any guess how I can get some more debugging info? FYI, the page has a form but also has Javascript and Ajax code.

Thanks,

Larry

--------------------------

The Code:

$myPage = _IECreate( "http://www.notTheRealURL.com/")

MsgBox(0, "NewIEwindowStatus","@Error is zero when this box gets displayed:" & @error)

Sleep(2)

$oForms = _IEFormGetCollection($myPage)

MsgBox(9,"This box never appears","Never!")

--------------------------

The Error:

Line 1075 (File "C:\Program Files\AutoIt3\Include\ie.au3"):

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

Return SetError($_IEStatus_Success, $oTemp.forms.length^ ERROR

Error: The Requested action with this object has failed.

I'm reasonably sure that it's the _IEFormGetCollection() function that is failing.

-------------------------

The webpage has at least one form on it. But it also has Javascript and Ajax code. Here is an abridged version of the page:

<html>

<head>

<title></title>

...

<script type="text/javascript" src="scripts/overlib.js?version=1"></script>

</head>

<body>

<center>

<div style="top: 10px;" id="content"><script language="Javascript">

function galaxy_submit(value) {...}

</script>

<script language="Javascript" src="scripts/tw-sack.js"></script>

<script type="text/javascript">

var ajax = new sack();

var strInfo = "";

function whenResponse () {...}

...

</script>

<body style="overflow: auto;" onunload=""><br><br>

<form action="galaxy.php?mode=1" method="post" id="galaxy_form"><input type="hidden" id="auto" value="dr">

<table border="0"><tbody><tr><td>

<table>

<tbody>

<tr><td class="c" colspan="3">Galaxy</td></tr><tr><td class="l">

<input name="galaxyLeft" value="&lt;-" onclick="galaxy_submit('galaxyLeft')" type="button">

<input value="Display" type="submit"></td></tr></tbody></table>

</form>

<table width=569><tbody>

Share this post


Link to post
Share on other sites



Error: The Requested action with this object has failed.

I'm reasonably sure that it's the _IEFormGetCollection() function that is failing.

Welcolme to the forum ! Posted Image

When i get this type of error message it's because IE bug !

Try with another PC...


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

It's irrelevant for the user what's causing the issue as long as the issue exists.

This is bug inside IE.au3. Doing

$oTemp.forms.length
...is wrong without checking if $oTemp.forms is actually an object.

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

If I'm reading you right, the _IEFormGetCollection is either not finding a document or not finding any forms. The latter is most likely. Now that I'm actually reading the _IE library code instead of just complaining :graduated: I can dig a bit deeper into what's going wrong.

Thanks

Share this post


Link to post
Share on other sites

If I'm reading you right, the _IEFormGetCollection is either not finding a document or not finding any forms. The latter is most likely. Now that I'm actually reading the _IE library code instead of just complaining :graduated: I can dig a bit deeper into what's going wrong.

Thanks

If there is no forms _IEFormGetCollection doesn't retun an error

#include <IE.au3>

$Url='http://aldo063.free.fr/'
$oIE = _IECreate ( $Url, 0, 0, 1 )
$oForms = _IEFormGetCollection ( $oIE )
For $oForm In $oForms
    ConsoleWrite ( "->--- Form name : " & $oForm.name & @CRLF ) 
Next

_IEQuit ( $oIE )

What's the url you use for get this error ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

I also inserted the following code and got the same error. $oObj.forms is non-zero but forms.length is not allowed. How can I see the type or contents of Objects?

myWin = _IECreate( "http://www.notTheRealURL.com")

$oObj = _IEDocGetObj($myWin)

if 0 = $oObj.forms Then

MsgBox(0,"No Forms","No Forms")

Else

MsgBox(0,"Forms Found?","FormCount=" & $oObj.forms.length )

EndIf

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

The URL won't help you because it's login protected. I attached the HTML source and a zip of the more complete .mht

i have tried like this and there is no error...

#include <IE.au3>

$Url='C:\galaxy_mht\1galaxy.php.htm'

$oIE = _IECreate ( $Url, 0, 0, 1 )
$oForms = _IEFormGetCollection ( $oIE )
For $oForm In $oForms
    ConsoleWrite ( "->--- Form name : " & $oForm.name & " Form method : " & $oForm.method & " Form action : " & $oForm.action & @CRLF ) 
    $index = 0
    $oFormElements = _IEFormElementGetCollection ( $oForm )
    For $oFormElement In $oFormElements
        ConsoleWrite ( "+>---           FormElement Index : " & $index & " FormElement Name : " & $oFormElement.name & " FormElement Type : " & $oFormElement.type & " FormElement Id : " & $oFormElement.Id & @CRLF )
        $index += 1
    Next
Next

_IEQuit ( $oIE )

result : Posted Image

->--- Form name : 0 Form method : post Form action : galaxy.php?mode=1

+>--- FormElement Index : 0 FormElement Name : 0 FormElement Type : hidden FormElement Id : auto

+>--- FormElement Index : 1 FormElement Name : galaxyLeft FormElement Type : button FormElement Id : 0

+>--- FormElement Index : 2 FormElement Name : galaxy FormElement Type : text FormElement Id : 0

+>--- FormElement Index : 3 FormElement Name : galaxyRight FormElement Type : button FormElement Id : 0

+>--- FormElement Index : 4 FormElement Name : systemLeft FormElement Type : button FormElement Id : 0

+>--- FormElement Index : 5 FormElement Name : system FormElement Type : text FormElement Id : 0

+>--- FormElement Index : 6 FormElement Name : systemRight FormElement Type : button FormElement Id : 0

+>--- FormElement Index : 7 FormElement Name : 0 FormElement Type : submit FormElement Id : 0

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

OK, I copied your code and ran it against the html I sent you = FAIL! So this is either a browser problem (as you first suggested) or a problem with my version of AutoIt. So I will try this on another PC.

Thanks for your help!

Share this post


Link to post
Share on other sites

... the script works fine on my other PC.

Thanks again!

Share this post


Link to post
Share on other sites

... the script works fine on my other PC.

Thanks again!

The simplest solutions are the best ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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