Sign in to follow this  
Followers 0
speedi

help! IEFormGetCollection simple signin script

6 posts in this topic

I guess I do not understand the ieform commands... I can't get a simple login script to work.

It does not populate the "username" and "password" fields.. Looking for help... Thanks..

The script:

; loigin script

#include <IE.au3>

$oIE = _IECreate("https://www.dealerspeed.net/")

_IELoadWait ($oIE)

WinSetState("DealerSpeed", "", @SW_MAXIMIZE)

WinWaitActive("DealerSpeed | Login - Windows Internet Explorer","")

$o_Form = _IEFormGetCollection ($oIE, 0)

$o_login = _IEFormElementGetObjByName ($o_form, "idForm")

$o_password = _IEFormElementGetObjByName ($o_form, "passwordForm")

$username = "user"

$password = "password"

; Set field values and submit the form

_IEFormElementSetValue ($o_login, $username)

_IEFormElementSetValue ($o_password, $password)

Exit

Share this post


Link to post
Share on other sites



Make sure you use DebugBar (or something similar) to examine the HTML structure. Post the messages written to the SciTe console when you run your code.

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

Make sure you use DebugBar (or something similar) to examine the HTML structure. Post the messages written to the SciTe console when you run your code.

Dale

the messages posted on the scite console are as follows:

--> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch

--> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

not sure I understand -- I did this routine to get the fomr names:

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

; Example 3 - Get a reference to the collection of forms on a page,

; and then loop through them displaying information for each

; demonstrating use of form index

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

;

#include <IE.au3>

$oIE = _IECreate ("https://www.dealerspeed.net/")

$oForms = _IEFormGetCollection ($oIE)

$iNumForms = @extended

MsgBox(0, "Forms Info", "There are " & $iNumForms & " forms on this page")

For $i = 0 to $iNumForms - 1

$oForm = _IEFormGetCollection ($oIE, $i)

MsgBox(0, "Form Info", $oForm.name)

Next

Share this post


Link to post
Share on other sites

Look carefully at the messages from the console. They may look complicated, but they are not. Notice the two $_IEStatus_NoMatch

warnings. It means that you sppecified the wrong field names, or you selected the wrong form (you selected the first form on the page, form 0).

You did not say whether you used DebugBar... I strongly recommend it.

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

I am using the debug bar now and I am making progress and understanding these commands better...

I will keep you posted thanks for your help....

Share this post


Link to post
Share on other sites

Dale, thanks so vey much... I have it working and certainly understand it much better...

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