Jump to content
Sign in to follow this  
bhodi78

IE automation

Recommended Posts

bhodi78

I would take the prices and flight times. The following code connects to the site easyjet select the city of departure and arrival, dates of departure and arrival .... but I can not find a way to collect this information because the two tables are generated dynamically and do not have an identifier. Some of you could help me?

#include <IE.au3>
#include <String.au3>
#include <Array.au3>

$departure="London Gatwick (LGW)"       
$destination="Amsterdam (AMS)"
$dayFly="17"
$monthFly="December"
$yearFly="2009"

$oIE = _IECreate ("http://www.easyjet.com/en/book/index.asp")
_IELoadWait ($oIE)

$Form  =_IEFormGetCollection ($oIE,0)

;Departure:
$o       =_IEFormElementGetObjByName ($Form,"orig")
_IEFormElementOptionselect ($o, $departure, 1, "byText")

;Destination:
$d = _IEFormElementGetObjByName ($Form,"dest")
_IEFormElementOptionselect ($d, $destination, 1, "byText")

;Day departure:
$gA = _IEFormElementGetObjByName ($Form,"oDay")
_IEFormElementOptionselect ($gA, $dayFly, 1, "byText")
$mA = _IEFormElementGetObjByName ($Form,"oMonYear")
_IEFormElementOptionselect ($mA, $monthFly&" "&$yearFly, 1, "byText")

;Day return:
$gR = _IEFormElementGetObjByName ($Form,"rDay")
_IEFormElementOptionselect ($gR, $dayFly+1, 1, "byText")
$mR = _IEFormElementGetObjByName ($Form,"rMonYear")
_IEFormElementOptionselect ($mR, $monthFly&" "&$yearFly, 1, "byText")

;submit form
$submit=_IEFormElementGetObjByName($Form,"btn_submitForm")
_IEAction ($Submit, "click")
_IELoadWait ($oIE)

;next Page
$Form  =_IEFormGetCollection ($oIE,0)
$dd=_IETableGetCollection($Form,-1)

;Andata
$A_Table = _IETableGetCollection ($Form, 1)
$A_TableData = _IETableWriteToArray ($A_Table,True)
_ArrayDisplay($A_TableData)

Exit

This is the result I would get:

Outbound:

£ 34.99 (Dep. 06:15, arr. 08:30)

£ 39.99 (Dep. 13:40, arr. 15:55)

£ 34.99 (Dep. 17:05, arr. 19:20)

£ 34.99 (Dep. 18:35, arr. 20:50)

Return:

£ 67.99 dep. (08:55, arr. 09:10)

£ 75.99 dep. (16:25, arr. 16:35)

£ 77.99 dep. (19:45, arr. 19:55)

£ 67.99 dep. (21:30, arr. 21:40)

I thank everyone in advance

bye.

Share this post


Link to post
Share on other sites
DaleHohm

Suggested functions:

_IETableGetCollection, _IETableWriteToArray

_IETagnameGetCollection, _IEPropertyGet(xxx, "innertext")

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  

×