Sign in to follow this  
Followers 0
3mustgetbeers

Populating an input box in IE

6 posts in this topic

Hi all,

Just trying to get to grips with the IE UDF but struggling a little :

All I want to do is populate an input box, for example google.  I am looking at the examples and came across "_IEFormSubmit" in the help file; and specifically the example "_IEFormElementGetObjByName".  When I run this example script Google opens but nothing is searched for.  The code is:

#include <IE.au3>

Local $oIE = _IECreate("http://www.google.com")
Local $oForm = _IEFormGetObjByName($oIE, "f")
Local $oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, "AutoIt IE.au3")
_IEFormSubmit($oForm)

And the console errors are:

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
--> IE.au3 V2.4-0 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType
--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 V2.4-0 Error from function _IEFormSubmit, $_IEStatus_InvalidDataType

As I say, I am just really getting started with the IE UDF so I'm at a bit of a loss to this, can anyone advise why the example isn't working for me - I haven't changed anything.  And also, does anybody have a simple script that will perform a Google search just to get me started?

Thanks!

3mgb

Share this post


Link to post
Share on other sites



The name of the form and of input. They are different. Check them in (developer tool F12 in IE) or firebug in FF.

Share this post


Link to post
Share on other sites

Hi Karlkar,

Thanks for that, you're quite right, amending the form name to "gbqf" makes this work.

Out of interest, is it possible to do a partial match on the form name - in this case, for example "gbq*" ??

Thanks again

Share this post


Link to post
Share on other sites

No, I'm afraid it is not possible :(

Share this post


Link to post
Share on other sites

Actually, you could do it by calling _IEFormGetCollection and then looping through the collection for forms with matching names.

1 person likes this

Share this post


Link to post
Share on other sites

Thanks both, further reading for me

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