Sign in to follow this  
Followers 0
Andrew Peacock

_IEFormElementGetObjByName error

14 posts in this topic

Hi all,

I'm getting an error using the IE.au3 script,and I'd really like some help

My code is as follows:

#include <IE.au3>
; Create a new browser window and navigate to a page
$oIE = _IECreate()
_IENavigate($oIE, "http://7.associatel.pay.clickbank.net")
; ENTER GEO DETAILS
; Find the form and the form fields we are interested in
$o_form     = _IEFormGetObjByIndex($oIE, 0)
$o_country      = _IEFormElementGetObjByName($o_form, "ctry")
$o_zip          = _IEFormElementGetObjByName($o_form, "zipc")

And the error :s

line 848 (File "C:\etc etc etc")

If IsObj($o_object.elements.item($s_name, $i_index)) Then
If ^ ERROR

Error: the requested action with this object has failed

Any idea why this form processing doesn't work? The HTML looks OK as far as I can see. Nothing fancy like IFRAMED pages or anything stupid.

Thanks for any help you can give!

Andy

Share this post


Link to post
Share on other sites



I know this is probably a silly question but are you using the latest beta version. I have tried your script and it works for me with no errors.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Hi,

Are you behind a proxy ?

If yes, don't write the domain name in the URL.

I had a similar problem the last week.

Please and tell me know if you still have the same problem.

FabFly

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi BigDid,

My versions are:

IE3.au = T1.4, which I think is the latest

AutoIt = 3.1.1.0 originally. I'm testing with 3.1.1.89, and I get this error now:

Line 776 (File etc etc etc)
If IsObj($o_object.elements) Then
If IsObj($o_object.e^ ERROR

Error: Unable to parse line

Fabfly, I am beind a firewall. Can you explain what you mean by "don't write the domain name in the URL"? If I miss out the domain name, how will it work?

Andy

Edited by Andrew Peacock

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Line 776 (File etc etc etc)
If IsObj($o_object.elements) Then
If IsObj($o_object.e^ ERROR

Error: Unable to parse line
Another user was having the same error a while back and I don't relcall if it was an issue of not knowing how to run the beta instead of the production release or if it was an issue with IE.au3 download. Check here for discussion and resolution.

For future reference, please include the full error report from AutoIt instead of editing it back -- it includes the version being used and could have other inforamtion that may not mean anything to you, but may be very important in debugging.

Dale

Edited by DaleHohm

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

Dale,

Sorted. I had set my filetypes in Windows Explorer to pick the beta, but no idea why that didn't work. Maybe it needs a reboot? The SciTe download is great - which I'd found it sooner!

Thanks everyone

Andy

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Oops. Not sorted. I didn't realise that sciTe hid the errors in the bottom pane.

Here's the output:

>"C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "C:\Documents and Settings\apeacock\My Documents\Personal\To Sync\Web\clickbankchecker\desktopscript\checker.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams    
>Running AU3Check...C:\Program Files\AutoIt3\SciTe\Defs\Unstable\Au3Check\au3check.dat
>AU3Check Ended. No Error(s).
>Running: (3.1.1.89):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Documents and Settings\apeacock\My Documents\Personal\To Sync\Web\clickbankchecker\desktopscript\checker.au3"    
C:\Documents and Settings\apeacock\My Documents\Personal\To Sync\Web\clickbankchecker\desktopscript\IE.au3 (848) : ==> The requested action with this object has failed.: 
If IsObj($o_object.elements.item ($s_name, $i_index)) Then 
If ^ ERROR
>AutoIT3.exe ended.
>Exit code: 0    Time: 4.476

Any ideas?

Edit: I've also installed a clean copy of AutoIt current release, beta release, and SciTe on a new machine, and get the same problem. But if I edit the script to open Google.com and get a reference to the search box, it works fine. Could it be something wierd about that clickbank page?

Andy

Edited by Andrew Peacock

Share this post


Link to post
Share on other sites

Well this is quite curious. I've never seem an issue in this code before and I see no obvious issues in the way the form is defined in the source.

I'll look into this further, but in the mean time you can access the form elements by index:

$o_country = _IEFormElementGetObjByIndex($o_form, 0)
$o_zip   = _IEFormElementGetObjByIndex($o_form, 1)

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

#9 ·  Posted (edited)

Well, I've found why this page fails when you try to query the FormElements by name. It is a very unique problem with this particular webpage and I don't believe it is in any way related to IE.au3.

The page contains the following hidden form field:

<input type=hidden name=item value="007">

The fact that this field has a name of "item" appears to confuse the form elements collection in the DOM. I have not tested in VBScript, but I suspect that the $o_object.elements.item ($s_name, $i_index) reference would fail in the same way.

You'll need to work around this with the ByIndex suggestion that I provided. I do not consider this to be a bug in IE.au3 (although I may be able to trap such an error at some point in the future instead of cryptically aborting as it does now).

Dale

Edit: I tested this in VBScript and it fails exactly the same way as it does in AutoIt. I checked the HTML 4.01 spec and could not find a restriction on the Name attribute other than this:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

It does not call out a restriction that it cannot be the string "item", so it could be a bug in the IE DOM or it is documented somewhere else that I missed

Well this is quite curious. I've never seem an issue in this code before and I see no obvious issues in the way the form is defined in the source.

I'll look into this further, but in the mean time you can access the form elements by index:

$o_country = _IEFormElementGetObjByIndex($o_form, 0)
$o_zip     = _IEFormElementGetObjByIndex($o_form, 1)

Dale

Edited by DaleHohm

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

Hi,

I had the same problem with the proxy of my company.

A proxy receive the http request and rebuilt it. For example, the policy security in my company is the following :

1- the proxy receive the URL

2- the proxy cut the URL and insulate the domain name

3- the proxy debrief the DNS to know where it must send the request

4- the proxy load the page with an URL without the domain name.

May be your firewall doing it.

Please try it and let me know if you'll solve your problem.

Regards,

FabFly

PS : it's not not an IE.au3 problem. I solved the same problem with this solution. Please look at this thread : http://www.autoitscript.com/forum/index.ph...14entry124214

Share this post


Link to post
Share on other sites

Thanks both of you for your help. I'll go with the IEFormElementGetObjByIndex solution for now,

Andy

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

@FabFly

The error message here and the one you experienced may look similar (both are caused by a problem with an object reference), but the solution for each is very different.

The trouble in this case is the use of what appears to be a reserved word in the NAME of one of the form elements.

thanks,

Dale

Edit: fixed typos

Edited by DaleHohm

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

Dale,

Hopefully you can help on the following - I've searched the forum, but can't find anything.

Once that form is submitted, how do I get a reference to the new page and form that are presented?

Regards,

Andy

Share this post


Link to post
Share on other sites

Dale,

Hopefully you can help on the following - I've searched the forum, but can't find anything.

Once that form is submitted, how do I get a reference to the new page and form that are presented?

Regards,

Andy

If the resulting page is displayed in the same browser window, then the reference that you have from your initial _IECreate or _IEAttach is still valid (i.e. $oIE in most of my examples). The references to objects on the page will have changed however adn you'll need to use functions like _IEFormGetObjByIndex to get a new reference.

If the form submission results in a new window being created you'll need to get a reference to it with _IEAttach().

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