Sign in to follow this  
Followers 0
BigDaddyO

Need help with _IEFormElementSetValue

2 posts in this topic

I am trying to log into this site http://esd.placeware.com/wintest/ with a generic name then click the Begin Test Now button. Seemed really easy but I can't seem to set the text in the name box?

from what I can tell in the Source the name box is called cn but I can't find it using AutoIT.

May also be because I can't figure out what the form name is so I can't use the sample code below.

$oIE = _IECreate(); Create a new browser window
_IENavigate($oIE, "http://esd.placeware.com/wintest/")
$o_SearchForm = _IEFormGetObjByName ($oIE, "sForm")
$o_Keywords = _IEFormElementGetObjByName ($o_SearchForm, "cn")
_IEFormElementSetValue ($o_Keywords, "Testing WebApps")

Hellllppppp...

Mike


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Note that this post refers to a finction in the IE Automation UDF Library

I am trying to log into this site http://esd.placeware.com/wintest/ with a generic name then click the Begin Test Now button.  Seemed really easy but I can't seem to set the text in the name box?

from what I can tell in the Source the name box is called cn but I can't find it using AutoIT.

May also be because I can't figure out what the form name is so I can't use the sample code below.

$oIE = _IECreate(); Create a new browser window
_IENavigate($oIE, "http://esd.placeware.com/wintest/")
$o_SearchForm = _IEFormGetObjByName ($oIE, "sForm")
$o_Keywords = _IEFormElementGetObjByName ($o_SearchForm, "cn")
_IEFormElementSetValue ($o_Keywords, "Testing WebApps")

Hellllppppp...

Mike

<{POST_SNAPBACK}>

Looking at the source of that page, here is the form definition:

<form id="browserTestForm" onsubmit="return validate();" action="http://www.placeware.com/cc/esdevents" method="get">
    <fieldset>
    <input type="hidden" name="id" value="Browser Check" id="Hidden1" />
    <input type="hidden" name="role" value="attend" id="Hidden2" />
    <input type="hidden" name="pw" value="open" id="Hidden3" />
    <input type="hidden" name="recording_agreement" value="accepted" id="Hidden4" />
    <input type="hidden" name="placewareLicenseCookie" value="true" id="Hidden5" />
    <p>Please enter your name: <input type="text" name="cn" id="cn" /></p>
    <input type="submit" value="Begin Test Now" id="Submit1" name="Submit1" />
    </fieldset>
</form>

IE treats the ID property and NAME properties interchangably, so the form name is "browserTestForm". Plug that in where you have sForm and it works. If you get the form name wrong it CANNOT work because the structure is hierarchical.

Remember that you can also reference a form by index if you don't want to figure out its name.

Dale

Edited by DaleHohm

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  
Followers 0