ionmang20 0 Posted September 29, 2010 How can I input a date in the Departure date field at www.lot.com ?Using the below method I succeeded with the other fields, but not with the Departure date.I also tried _IEImgClick, but without success.#include <IE.au3> Func Click_Id($_IE, $_Id, $_Text = "") Local $_Obj = _IEGetObjById($_IE, $_Id) _IEAction($_Obj, "click") If $_Text = "" Then Return Sleep(1500) Send($_Text) Sleep(1000) Send("{ENTER}") EndFunc ;==>Click_Id $IE = _IECreate("http://www.lot.com", 0, 1, 1, 1) Click_Id($IE, "ext-gen7", "Budapest [BUD]") Click_Id($IE, "ext-gen19", "Sofia [SOF]") Click_Id($IE, "selectedStartDate", "30-09-2010") Share this post Link to post Share on other sites
DaleHohm 65 Posted September 29, 2010 (edited) Suggest you use DebugBar to figure out how that calendar is structured... it is encapsulated in a DIV element with an ID of ui-datepicker-div, in turn there is a table with the days of the month... with TRs and TDs. $oDiv = _IEGetObjById($oIE, "ui-datepicker-div") $oTable = _IETagnameGetCollection($oDiv, "table", 0) To click on the 5th row, 3rd cell you would $oTR = _IETagnameGetCollection($oTable, "tr", 4) $oTD = _IETagnameGetCollection($oTR, "td", 2) _IEAction($oTD, "click") Dale Edit: fix typos Edited September 29, 2010 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curlMSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object modelAutomate input type=file (Related)Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better?IE.au3 issues with Vista - WorkaroundsSciTe 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
wakillon 404 Posted September 29, 2010 (edited) Try this #include <IE.au3> $oIE = _IECreate("http://www.lot.com", 0, 1, 1, 1) $oForm = _IEFormGetObjByName ($oIE, "miniBookerForm") $oText = _IEFormElementGetObjByName ($oForm, "selectedStartDate") _IEFormElementSetValue ($oText, "30-09-2010") Edited September 29, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
ionmang20 0 Posted September 29, 2010 (edited) @DaleHohm : Thanks, but your solution is a little bit complicated for me, and I can't make it work.@wakillon : Thanks, your solution is simple and I understand it.I have run into another problem, how can I click the Search button ?It does't have a name or ID: <A class=button-red onclick="bookFlightRequest(); return false;" href="javascript:void(0);">SEARCH</A>I tried with _IEFormSubmit($Obj) and _IEImgClick($Obj, "SEARCH", "name"), but witout succes.Can I run bookFlightRequest() java function ?#include <IE.au3> Flight() Func SetObjValue($_Form, $_Id, $_Text) Local $_Obj = _IEGetObjById($_Form, $_Id) _IEFormElementSetValue($_Obj, $_Text) EndFunc ;==>SetObjValue Func Flight() Local $IE = _IECreate("http://www.lot.com", 0, 1, 1, 1) Local $Obj = _IEFormGetObjByName($IE, "miniBookerForm") SetObjValue($Obj, "originId", "Budapest [BUD]") SetObjValue($Obj, "destinationId", "Sofia [SOF]") SetObjValue($Obj, "selectedStartDate", "02-10-2010") SetObjValue($Obj, "selectedAdultNumber", "2") SetObjValue($Obj, "selectedChildNumber", "2") EndFunc ;==>Flight Edited September 29, 2010 by ionmang20 Share this post Link to post Share on other sites
wakillon 404 Posted September 30, 2010 @DaleHohm : Thanks, but your solution is a little bit complicated for me, and I can't make it work. @wakillon : Thanks, your solution is simple and I understand it. I have run into another problem, how can I click the Search button ? It does't have a name or ID: <A class=button-red onclick="bookFlightRequest(); return false;" href="javascript:void(0);">SEARCH</A> I tried with _IEFormSubmit($Obj) and _IEImgClick($Obj, "SEARCH", "name"), but witout succes. Can I run bookFlightRequest() java function ? Thanks, I will see that.... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
wakillon 404 Posted September 30, 2010 Try _IELinkClickByText ( $IE, "Recherche" )but you must set arrival date before ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
ionmang20 0 Posted September 30, 2010 Thanks a lot, it works just fine. #include <IE.au3> Flight() Func SetObjValue($_Form, $_Id, $_Text) Local $_Obj = _IEGetObjById($_Form, $_Id) _IEFormElementSetValue($_Obj, $_Text) EndFunc ;==>SetObjValue Func Flight() Local $IE = _IECreate("http://www.lot.com", 0, 1, 1, 1) Local $Obj = _IEGetObjById($IE, "flightOnewayLabel") _IEAction($Obj, "click") Local $Obj = _IEFormGetObjByName($IE, "miniBookerForm") SetObjValue($Obj, "originId", "Budapest [BUD]") SetObjValue($Obj, "destinationId", "Sofia [SOF]") SetObjValue($Obj, "selectedStartDate", "02-10-2010") SetObjValue($Obj, "selectedAdultNumber", "2") SetObjValue($Obj, "selectedChildNumber", "2") _IELinkClickByText ( $IE, "SEARCH" ) EndFunc ;==>Flight Share this post Link to post Share on other sites
wakillon 404 Posted September 30, 2010 Thanks a lot, it works just fine.Glad to help you ! but i don't see arrival date in your script... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
ionmang20 0 Posted September 30, 2010 Yes, that's because I'm looking for an oneway ticket _IEGetObjById($IE, "flightOnewayLabel") Share this post Link to post Share on other sites
ionmang20 0 Posted September 30, 2010 I'm struggling for a few hours to get the thicket price values form the following week table in the IE page:But I don’t seem to get it right.Can you point me in the right direction or tell me where I made mistakes?If an object, form or element has a name or ID, I think, I can manage it, but if not, it seems I’m not up to the challenge.Also if you know of a better explained topic regarding IE functions, I’ll be glad if you’ll share it with me, because I don’t seem to understand the AutoIt help file.#include <IE.au3> Flight() Func SetObjValue($_Form, $_Id, $_Text) Local $_Obj = _IEGetObjById($_Form, $_Id) _IEFormElementSetValue($_Obj, $_Text) EndFunc ;==>SetObjValue Func Flight() Local $IE = _IECreate("http://www.lot.com", 0, 1, 1, 1) Local $Obj = _IEGetObjById($IE, "flightOnewayLabel") _IEAction($Obj, "click") Local $Obj = _IEFormGetObjByName($IE, "miniBookerForm") SetObjValue($Obj, "originId", "Budapest [BUD]") SetObjValue($Obj, "destinationId", "Sofia [SOF]") SetObjValue($Obj, "selectedStartDate", "06-10-2010") SetObjValue($Obj, "selectedAdultNumber", "2") SetObjValue($Obj, "selectedChildNumber", "2") _IELinkClickByText ( $IE, "SEARCH" ) _IELoadWait($IE) $Form = _IEFormGetCollection($IE, 0) $Elem = _IEFormElementGetCollection($Form) $n = 0 For $oElem In $Elem ConsoleWrite($n & " Name:" & $oElem.name& ":" & _IEFormElementGetValue($oElem) & @LF) $n += 1 Next EndFunc ;==>Flight Share this post Link to post Share on other sites