Jump to content

Need Help Logining Into Website..?


 Share

Recommended Posts

Im having trouble with the login part on this website http://browsershots.org/accounts/login

this is the sites form source code

<form action="" method="post">
<table>

<tr><th><label for="id_username">Username:</label></th><td><input id="id_username" type="text" name="username" maxlength="30" /></td></tr>
<tr><th><label for="id_password">Password:</label></th><td><input id="id_password" type="password" name="password" maxlength="40" /></td></tr>
<tr><th></th><td>
<input type="hidden" name="next" value="/accounts/profile/" />
<input type="submit" value="Let me in" />
</td></tr>
</table>
</form>

this is my auto it code thus far... what is the correct way to Submit/Login with the username & password on that website..??

$IE = _IECreate("http://browsershots.org/accounts/login",0,1,1,0)

$username = _IEGetObjByName($IE, "username")
_IEFormElementSetValue ($username, "xxxxx")

$password = _IEGetObjByName($IE, "password")
_IEFormElementSetValue ($password, "xxxxx")

$next = _IEGetObjByName($IE, "next")
_IEAction($next, "click")
Link to comment
Share on other sites

Whoever made that page decided not to give the "Let me in" button a name for us to reference...

This works though:

#include <IE.au3>

$oIE = _IECreate("http://browsershots.org/accounts/login")

$oForm = _IEFormGetCollection ($oIE, 1)

$username = _IEGetObjByName($oIE, "username")
_IEFormElementSetValue ($username, "xxxxx")

$password = _IEGetObjByName($oIE, "password")
_IEFormElementSetValue ($password, "xxxxx")

_IEFormSubmit ($oForm)
Link to comment
Share on other sites

wow, thank you so much exodius..

this was frustrating me so much cuz i couldn't figure out why there was no Name value for the "Let me in" button..

So what all were you able to see then for those 2 forms..??

what is the other form If the form that we're using in this code is form 1..??

And what do each of the forms belong to..??

what are we submitting on this form 1 anyway..?? the username or password or both..

Sorry for all the ??'s im just a lil perplexed on how this function works & how you were able to determine what was going on & what you did you solve it all.. mind explaining a lil more please..??

naw.. I dont use IE or that DebugBar thing at all, Im a FireFox guy myself...

is there any FF plugin that can do what that IE DebugBar plugin can do..??

Link to comment
Share on other sites

Personally, I'm a FireFox guy too, but unfortunately it's not so much whether there's a plugin for FireFox as Firefox doesn't currently have a COM interface (which is what the _IE functions use) so you can't automate it like you can IE.

If you're curious how the _IE functions work, go poke around in your C:\Program Files\AutoIt3\Include\IE.au3 file, just don't try to change anything in there, it's read-only and you don't want to break it.

Using the _IEFormSubmit function, you're basically telling the form that you've gotten an object for to perform it's submit function. So whatever it usually reads when it does that, it'll read and try to use/authenticate.

The other form looks like something to do with selecting a language, but I'm going to heavily suggest that if you want to automate web stuff that you get the DebugBar - it's even got a "finder" icon like the Au3Info tool that you can drag onto a webpage control (like an input field) and it'll take you to that part of the HTML, basically giving you the name so you don't have to dig through it to find what you want.

Link to comment
Share on other sites

So when you used that _IEFormGetCollection function the first Form that it finds in a webpage is labeled as ( 0 ) and ever proceeding form is +1 from the previous form Ex. 0,1,2,3,4 Ect ..??

and the _IEFormSubmit function is just like clicking the submit button or pressing enter to submit that forms user entered data then..??

what qualifications,names or ID's does _IEFormSubmit need to work properly on a form in a webpage..??

what would you need to determine if your deciding between to use: _IEFormSubmit & _IEAction($IE, "click") on a form submission..??

I did Install that DebugBar on IE in my VM just to see what you were talking about, it seems very helpful ,thanks for informing me about it..

thanks for yer help..

Link to comment
Share on other sites

So when you used that _IEFormGetCollection function the first Form that it finds in a webpage is labeled as ( 0 ) and ever proceeding form is +1 from the previous form Ex. 0,1,2,3,4 Ect ..??

Correct :P

and the _IEFormSubmit function is just like clicking the submit button or pressing enter to submit that forms user entered data then..??

Correct again.

what qualifications,names or ID's does _IEFormSubmit need to work properly on a form in a webpage..??

what would you need to determine if your deciding between to use: _IEFormSubmit & _IEAction($IE, "click") on a form submission..??

_IEFormSubmit requires an object for a form.

The easiest way to determine that would be to try it. :unsure: In most cases where _IEFormSubmit would work, _IEAction would too. But the same isn't true vice versa - the most common cases being where it's a javascript button

I did Install that DebugBar on IE in my VM just to see what you were talking about, it seems very helpful ,thanks for informing me about it..

thanks for yer help..

For sure, and you're welcome. :D

Edited by exodius
Link to comment
Share on other sites

The easiest way to determine that would be to try it. smile.gif In most cases where _IEFormSubmit would work, _IEAction would too. But the same isn't true vice versa - the most common cases being where it's a javascript button

so for the login form for http://browsershots.org/accounts/login what distinction is there that determines that we have to use the _IEFormSubmit function instead of the _IEAction($IE, "click") function..??

DebugBar - it's even got a "finder" icon like the Au3Info tool that you can drag onto a webpage control (like an input field) and it'll take you to that part of the HTML, basically giving you the name so you don't have to dig through it to find what you want.

where is this feature, i want to test it out, what is the finder icon look like or where is it on the debugbar..??

Link to comment
Share on other sites

I don't know if preforming a click event on the InternetExplorer.Application (here it's $IE) makes any sense. The click is on the button reference you got like $oButton = _IEGetObjByName($IE, 'BtnSub')... _IEAction($oButton, 'click').

Submitting a form is preformed on a form object reference (if it can be called like that...) like:

$oForm = _IEFormGetObjByName($IE, 'fLogin')

_IEFormSubmit($oForm) * Read the remarks about these functions if you're experiencing issues.

Edited by Authenticity
Link to comment
Share on other sites

so whats the better functions to use then on these 2 sites..?

http://browsershots.org

http://browsershots.org/accounts/login

how do you determine what function is best to use ( _IEFormGetCollection, _IEFormGetObjByName, _IEFormSubmit, _IEAction($IE, "click" ) for submitting the URL form on the 1st site and submitting your login credentials on the 2nd site..??

Link to comment
Share on other sites

Try this, it's not best but still sufficient:

#include <IE.au3>

$o_IE = _IECreate('http://browsershots.org/accounts/login/')
$oForm = _IEFormGetCollection($o_IE, 1)


$oName = _IEGetObjById($o_IE, 'id_username')
$oPass = _IEGetObjById($o_IE, 'id_password')

_IEFormElementSetValue($oName, 'MyAccount')
_IEFormElementSetValue($oPass, 'MyPassword')
Sleep(1000)
_IEFormSubmit($oForm, 0)
Link to comment
Share on other sites

so whats the better functions to use then on these 2 sites..?

http://browsershots.org

http://browsershots.org/accounts/login

how do you determine what function is best to use ( _IEFormGetCollection, _IEFormGetObjByName, _IEFormSubmit, _IEAction($IE, "click" ) for submitting the URL form on the 1st site and submitting your login credentials on the 2nd site..??

Those 4 functions all work pretty reliably, it really just boils down to trial and error... In some cases you won't be able to get a form's name so you have to use the collection function, other times you can just use the collection function and forego the name altogether...

The same thing is true of the submit and action functions, both will work in some cirumstances, but sometimes you have to go with one or the other.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...