Sign in to follow this  
Followers 0
Neoborn

Problem With IE Form Username / Password Input

16 posts in this topic

#1 ·  Posted (edited)

Hello Guys,

I am trying to auto login to this page(Not Safe For Work) but cannot for some reason get it to input the username and password values into the correct form fields. Can anyone help me with this and possibly tell me why?

#include <IE.au3>

$oIE = _IECreate("http://www.theforum.com/forumdisplay.php?f=4", 1)

$o_login = _IEFormElementGetObjByName ($oIE, "vb_login_username")
$o_password = _IEFormElementGetObjByName ($oIE, "vb_login_password")
;~ $o_signin = _IEFormElementGetObjByName ($o_form, "Log in")

$username = "Fr3@K@Z°!d@L"
$password = "jesus"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
Edited by Neoborn

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites



_IEFormElementGetObjByName takes a form as the first param, not a browser object. Please see the helpfile and examples.

Dale

Hello Guys,

I am trying to auto login to this page(Not Safe For Work) but cannot for some reason get it to input the username and password values into the correct form fields. Can anyone help me with this and possibly tell me why?

#include <IE.au3>

$oIE = _IECreate("http://www.theforum.com/forumdisplay.php?f=4", 1)

$o_login = _IEFormElementGetObjByName ($oIE, "vb_login_username")
$o_password = _IEFormElementGetObjByName ($oIE, "vb_login_password")
;~ $o_signin = _IEFormElementGetObjByName ($o_form, "Log in")

$username = "Fr3@K@Z°!d@L"
$password = "jesus"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)

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)

Sorry I am a total newb to IE.au3 etc. Can you instruct me further?

What is the name of the form? Can you guys get this to work for you?

Edited by Neoborn

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

Sorry I am a total newb to IE.au3 etc. Can you instruct me further?

What is the name of the form? Can you guys get this to work for you?

The forms on that page don't have names. You'll need to use _IEFormGetCollection and specify an index.

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

That form get collection says "there are three forms on this page" then "0", "0" and "0"

Any help?


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

That form get collection says "there are three forms on this page" then "0", "0" and "0"

I don't know what that means - "That form get collection says"

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 don't know what that means - "That form get collection says"

This command _IEFormGetCollection produces a msg box that says "there are three forms on this page" then "0", "0" and "0"


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

This command _IEFormGetCollection produces a msg box that says "there are three forms on this page" then "0", "0" and "0"

You'll need to show your code because there is nothing in IE.au3 that would produce anything like that.

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

You'll need to show your code because there is nothing in IE.au3 that would produce anything like that.

Dale

I think he might be refering to this:

#include <IE.au3>

$oIE = _IECreate ("http://www.autoitscript.com")

$oForms = _IEFormGetCollection ($oIE)

MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")

For $oForm In $oForms

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

Next

He might have adlibed the "MsgBox" to get 0,0,0. I get one '0'

I'm very interested in the outcome of this post. I have a URL that apparently does not have forms either.

Share this post


Link to post
Share on other sites

I think he might be refering to this:

#include <IE.au3>

$oIE = _IECreate ("http://www.autoitscript.com")

$oForms = _IEFormGetCollection ($oIE)

MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")

For $oForm In $oForms

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

Next

He might have adlibed the "MsgBox" to get 0,0,0. I get one '0'

I'm very interested in the outcome of this post. I have a URL that apparently does not have forms either.

OK, so that is one of the examples in the helpfile for _IEFormGetCollection, it is obviously not the function itself.

You can reference forms (or any element by name or by Index. The *GetCollection routines can return either a collection or a single object by specifying its index.

Here is the example expanded to hpefully make it clear:

#include <IE.au3>
$oIE = _IECreate ("http://www.google.com", 1)
$oForms = _IEFormGetCollection ($oIE)
MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")
$i = 0
For $oForm In $oForms
    MsgBox(0, "Form Info: " & $i, "get a reference to this form with:" & @CR & @CR & @TAB & _
    "$oForm = _IEFormGetCollection($oIE, " & $i & ")")
    $i += 1
Next

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

Just thought I'd add this to maybe help clear things up even farther.

#include <IE.au3>

_IEErrorHandlerRegister()

$oIE = _IECreate("http://www.google.com")
$oForms = _IEFormGetCollection($oIE)
MsgBox(0, "Form(s) Info", "There are " & @extended & " form(s) on this page")
$i = 0
For $oForm In $oForms
    MsgBox(0, "HTML for Form " & $i, $oForm.innerHTML)
    $i += 1
Next

Share this post


Link to post
Share on other sites

(Wow, I was going to delete my post after further thought, but I was 'caught' with two replies.)

Thanks for the Fast response!

I tried both above examples using "google" and it was very informative, but what about sites like this:

https://ola.orcasnet.com/cuso/members/wfs/

It reports "0" forms in the Msgs and that's it.

I now use winwait and sendkeys. I perfer the IE.au3 method, its faster and more stable.

I've searched for more examples of IE.au3 , but can't find usage for the above page.

vim

Share this post


Link to post
Share on other sites

The page has frames, this code shows how to get a reference to a form from within a frame.

#include <IE.au3>

_IEErrorHandlerRegister()

$oIE = _IECreate("https://ola.orcasnet.com/cuso/members/wfs/")
; Get a reference to the "member" frame
$oFrame = _IEFrameGetObjByName($oIE, "member")
; Get a collection of forms within the frame
$oForms = _IEFormGetCollection($oFrame)
MsgBox(0, "Form(s) Info", "There are " & @extended & " form(s) on this page")
$i = 0
For $oForm In $oForms
    MsgBox(0, "HTML for Form " & $i, $oForm.innerHTML)
    $i += 1
Next

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

'big_daddy', Thank you. You've been big help. Now I have something I can study...

vim

The page has frames, this code shows how to get a reference to a form from within a frame.

#include <IE.au3>

_IEErrorHandlerRegister()

$oIE = _IECreate("https://ola.orcasnet.com/cuso/members/wfs/")
; Get a reference to the "member" frame
$oFrame = _IEFrameGetObjByName($oIE, "member")
; Get a collection of forms within the frame
$oForms = _IEFormGetCollection($oFrame)
MsgBox(0, "Form(s) Info", "There are " & @extended & " form(s) on this page")
$i = 0
For $oForm In $oForms
    MsgBox(0, "HTML for Form " & $i, $oForm.innerHTML)
    $i += 1
Next
Edited by vim

Share this post


Link to post
Share on other sites

I wrote a little script to automate logins for all kind of webpages. You can find the script at

http://www.autoitscript.com/forum/index.php?showtopic=19403

In your case you could do:

KeeForm https://ola.orcasnet.com/cuso/members/wfs/ USERNAME PASSWORD {ENTERFORM}

KeeForm http://www.theforum.com/forumdisplay.php?f=4 USERNAME PASSWORD {ENTERFORM}

Other examples are:

KeeForm mail.yahoo.com USERNAME PASSWORD {ENTERFORM}

KeeForm http://www.autoitscript.com/forum/index.php?act=Members USERNAME PASSWORD {ENTERFORM}

I recommend to combine KeeForm with KeePass keepass.sf.net (this might be better than storing your passwords in files)

Hope this helps.

Cheers, Dave

Share this post


Link to post
Share on other sites

I wrote a little script to automate logins for all kind of webpages. You can find the script at

http://www.autoitscript.com/forum/index.php?showtopic=19403

In your case you could do:

KeeForm https://ola.orcasnet.com/cuso/members/wfs/ USERNAME PASSWORD {ENTERFORM}

KeeForm http://www.theforum.com/forumdisplay.php?f=4 USERNAME PASSWORD {ENTERFORM}

Other examples are:

KeeForm mail.yahoo.com USERNAME PASSWORD {ENTERFORM}

KeeForm http://www.autoitscript.com/forum/index.php?act=Members USERNAME PASSWORD {ENTERFORM}

I recommend to combine KeeForm with KeePass keepass.sf.net (this might be better than storing your passwords in files)

Hope this helps.

Cheers, Dave

Thanks 'AutoDave' !.

I didn't see your reply until today. It works!

ViM

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