Sign in to follow this  
Followers 0
sigil

can't find form with _IEFormGetCollection()

6 posts in this topic

I'm trying to open IE to Google Maps, then enter an address and search for it.

So far I have:

$oIE=_iecreate("maps.google.com")
$searchform=_ieformgetcollection($oIE,0)
$query=_ieformelementgetcollection($searchform,0)
_IEFormElementSetValue ($query, "los angeles, ca")
_ieformsubmit($searchform)

But that doesn't set any value into the search input box. I've looked over the source code for the Google Maps page, and I think I've got the right form and element--not entirely sure about that, it's hard for me to figure out what's going on in the source for this page.

Any ideas?

Share this post


Link to post
Share on other sites



Please show the output to the SciTe console


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

#3 ·  Posted (edited)

Please show the output to the SciTe console

No errors; this is all I got:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut >Exit code: 0 Time: 2.336

Edited by sigil

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

There are no errors, technically, but the element you want is nowhere near index=0. This is what the HTML looks like:

<form id=q_form action=/maps target=vp onsubmit="return onSearch(this)">
<input type=hidden name=f value=q>
<input type=hidden name=source value=s_q />
<input type=hidden name=output value=js />
<input type=hidden name=hl value=en />
<input type=hidden name=geocode value="" />
<div id=logo class=srchcol>
<a href=/maps?ct=reset>
<img class=logo-img src=/intl/en_us/images/maps_small_horizontal_logo.png width=169 height=40 alt="Go to Google Maps Home" />
</a>
</div>
<div class="srchcol controls">
<input type=text id=q_d name=q title="Search the map" tabindex=1 maxlength=2048 autocomplete=off value="" />
<span id=so style=display:none>
<select name=mrt id=mrtbox disabled=true onchange=setSrchEx(this.value);><option value=all selected=selected>All results</option>
<option value=loc>Locations</option>
<option value=yp>Businesses</option>
<option value=kmlkmz>User-created content</option>
<option value=ds>Related maps</option>
<option value=realestate>Real estate</option>
</select>
</span>
<input type=submit id=q-sub name=btnG tabindex=2 class=btn value="Search Maps" />
<span id=solink>
<a href=javascript:void(0) log=showss onclick="return setMrt('all');" id=showss>Show search options</a>
<a href=javascript:void(0) log=hides onclick="return setMrt(null);" id=hidess style=display:none>Remove search options</a>
</span>
<div class=example><span id=srchex>Find businesses, addresses and places of interest.</span>
</div>
</div>
</form>

It works if you use:

$searchform = _IEFormGetObjByName($oIE, "q_form")
$query = _IEFormElementGetObjByName($searchform, "q_d")

:D

Edit: Rats, out-typed by KaFu!

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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