Sign in to follow this  
Followers 0
MazeMiami

Login - Form Element Help

6 posts in this topic

#1 ·  Posted (edited)

Ok so I'm a complete noob, i been working with auto it for like 8 hours now and I'm now trying to get a script that will log me into a site. I used the search button and have read 100 post just like this one and i am still unable to get the thing to work .. i even downloaded Firefox Web developer add on as suggested here still no luck.

I'm using code that is found in the auto it help documentation

#include <IE.au3>


; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://forums.digitalpoint.com/")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "workdarnyou"
$password = "your password here"

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

i have tried to input ever forum element i see and none work

$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")

navbar_username

vb_login_username

vb_login_md5password

vb_login_md5password_utf

the site I'm attempting to log in on is http://forums.digitalpoint.com/

Edited by MazeMiami

Share this post


Link to post
Share on other sites



Ok so I'm a complete noob, i been working with auto it for like 8 hours now and I'm now trying to get a script that will log me into a site. I used the search button and have read 100 post just like this one and i am still unable to get the thing to work .. i even downloaded Firefox Web developer add on as suggested here still no luck.

I'm using code that is found in the auto it help documentation

#include <IE.au3>


; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://forums.digitalpoint.com/")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "workdarnyou"
$password = "your password here"

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

i have tried to input ever forum element i see and none work

$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")

navbar_username

vb_login_username

vb_login_md5password

vb_login_md5password_utf

the site I'm attempting to log in on is http://forums.digitalpoint.com/

Try my password manager that's in my sig. If all you want to do is login I highly suggest it for doing so.

I also provide the source to it. So feel free to paw through it and figure out how I do it or how you may fix yours :P

Share this post


Link to post
Share on other sites

The form has no name so you need to use _IEFormGetCollection. The FireFox tool is fine, I use DebugBar to get the username field name is vb_login_username, password is vb_login_password. Try

$oForm = _IEFormGetCollection($oIE, 0)
$oUname = _IEFormElementGetObjByName($oForm, "vblogin_username")
$oUpword = _IEFormElementGetObjByName($oForm, "vblogin_password")
_IEFormElementSetValue($oUname, "username")
_IEFormElementSetValue($oPword, "password")
_IEFormSubmit($oForm)

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

#4 ·  Posted (edited)

If you're just trying to log in, wouldn't a user-like way of doing this be easier?

Like this:

#include <IE.au3>
$oIE = _IECreate ("http://forums.digitalpoint.com/")
Send ("{TAB}")
Send ("{TAB}")
Sleep (500) 
Send ("USERNAME")
Send ("{TAB}")
Send ("PASSWORD")
Send ("{ENTER}")

(Working example)

Edited by nf67

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

The form has no name so you need to use _IEFormGetCollection. The FireFox tool is fine, I use DebugBar to get the username field name is vb_login_username, password is vb_login_password. Try

$oForm = _IEFormGetCollection($oIE, 0)
$oUname = _IEFormElementGetObjByName($oForm, "vblogin_username")
$oUpword = _IEFormElementGetObjByName($oForm, "vblogin_password")
_IEFormElementSetValue($oUname, "username")
_IEFormElementSetValue($oPword, "password")
_IEFormSubmit($oForm)

Dale

here what i did still no luck .. loving this shit even though it's kicking my ass :P

#include <IE.au3>


; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://forums.digitalpoint.com/")

; get pointers to the login form and username, password and signin fields
$oForm = _IEFormGetCollection($oIE, 0)
$o_login = _IEFormElementGetObjByName($oForm, "vblogin_username")
$o_password = _IEFormElementGetObjByName($oForm, "vblogin_password")
$oForm = _IEFormElementGetObjByName ($oForm, "SI")

$username = "workdarnyou"
$password = "your password here"

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

also not clear what the 0 does in ($oIE,0)

_IEFormGetCollection($oIE, 0)

same goes for"SI" in ($oForm, "SI")

$oForm = _IEFormElementGetObjByName ($oForm, "SI")

something about return values maybe ? not clear on this

nf67

thanks for the reply.. looking to do a bunch of stuff with IE so attempting to learn the IE funtions

Edited by MazeMiami

Share this post


Link to post
Share on other sites

Dale

i was able to to get this baby to work !! thanks so much i'm sure i'll have 98084 more questions!

working code

#include <IE.au3>


; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://forums.digitalpoint.com/")

; -Get pointers to the login form and username, password and signin fields-

;_IEFormGetCollection:
; Returns a collection object variable representing the Forms in the document or a single form by index.
$oForm = _IEFormGetCollection($oIE, 0) 

;_IEFormElementGetObjByName:
; Returns an object reference to a Form Element by name.
$o_login = _IEFormElementGetObjByName($oForm, "navbar_username") 
$o_password = _IEFormElementGetObjByName($oForm, "navbar_password")


$username = "xxxxxx"
$password = "xxxxxx"


; -Set field values and submit the form-

;_IEFormElementSetValue
;Set the value of a specified Form Element.
_IEFormElementSetValue ($o_login, $username) 
_IEFormElementSetValue ($o_password, $password)

;_IEFormSubmit:
;Submit a specified Form.
;_IEFormSubmit($oForm)

i added what each function does so i would understand how it worked with out looking back at the help document each time, looks silly but helped me :P

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