Jump to content
Sign in to follow this  

How to get control ID / Handle with IE

Recommended Posts

I'm trying to write a small autoit script to set a few defaults on the ryanair.com website. For example the Journey Origin.

But I can't get the ID or handle of the control, it seems invisible from Au3Info.exe.

I can select the control with mouseclick (example hereafter) and then tab up / down but all this seems very akward.

Anyone sees a more elegant way to do this ? (something like SetControlValue(Origin_box_id, "Almeria (LEI)" )



; Create IE Screen and Navigate


$_ScreenVar1 = _IECreate()

$url = "www.ryanair.com"

_IENavigate($_ScreenVar1, $url, 1)


; Get window title, maximize, Activate, Sleep


$title = WinGetTitle("Ryanair", "")

WinSetState ( $title, "", @SW_MAXIMIZE)

WinActivate("Ryanair", "")



; Go to From box by clicking it and then 5 down to Almeria for example


MouseClick("", 90, 335)






Share this post

Link to post
Share on other sites

Ok, that's a good suggestion as I am an absolute beginner to this.

Probably _IEFormElementSetValue should do the trick, but I still don't understand how to identify each control.

In attached sample from IE for example, where does "textExample" come from in

$oText = _IEFormElementGetObjByName ($oForm, "textExample") ?

I don't see it on screen, nor with Au3Info ?

I must miss something fundamentally here; thanks for clarifying.

; *******************************************************

; Example 1 - Open a browser with the form example, set the value of a text

; form element, retrieve and display the value from the element

; *******************************************************


#include <IE.au3>

$oIE = _IE_Example ("form")

$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")

$oText = _IEFormElementGetObjByName ($oForm, "textExample")

$IEAu3Version = _IE_VersionInfo ()

_IEFormElementSetValue ($oText, $IEAu3Version[5])

MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oText))

Share this post

Link to post
Share on other sites

Thanks, this was useful.

I'm able to read and set all the controls now, except for the radiobutton Return / One Way.

Neither of the two RadioSelect commands will do so, returning @error 0 and 7 respectively.

$oForm = _IEFormGetCollection ($_ScreenVar1,0)

_IEFormElementRadioSelect ($oForm, "One Way", "travel_type", 1, "byValue")


_IEFormElementRadioSelect ($oForm, 1, "One Way", 1, "byIndex")

In the screen source code I see

<input type="radio" name="travel_type" id="tt1" onclick="change_sector_2_fields(0,false)" checked><label for="tt1"><b>Return</b></label>


<td class="sub">

<input type="radio" name="travel_type" id="tt2" onclick="change_sector_2_fields(1,false)"><label for="tt2"><b>One Way</b></label>

Any ideas ?

Share this post

Link to post
Share on other sites

Also, suggest you run your code from SciTe and watch the console for more diagnistic messages.


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

Shevilie, Dale,

Ok I also got the radiobutton working ! With this all seemed ready !

But then I spend another 4 hours to find out how to click the submit ("search for cheap flights") button...

- I couldn't see any info with auinfo window.

- The source code reads <input class="submitlg" value="Search for Cheap Flights" type="button" onclick="submit_SB_Form()">

- So I tried to submit the form (also cycled through all the forms submitting them one by one) but didn't give result, I presume because of javascript.

- In the helpfile I read about _IEAction ($oSubmit, "click") so tried this on the elements I thought were the one but nothing (got the 3 other buttons working just below the real one so really puzzled)

- To make sure I didn't miss something, I cycled through all 7 forms, and within each form cycled through all elements and clicked them all one by one. But didn't get the button to work.

Is there some html/javascript trick on the site blocking this ?

Or just a beginners mistake ?

Any hints much appreciated.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...