Jump to content

Can't submit an IE form for login, can't think of any more ways to do it


icu
 Share

Recommended Posts

Dear AutoIt Community,

I'm having trouble logging into a specific site. I can't say I know a lot about DOM elements and such but I have been getting better and better at using IE-Builder to figure out how to get AutoIt to do what I want it to do in IE.

However now I'm stuck... on a website called www.newsinslowspanish.com. My wife has a paid subscription but she wants all the mp3s and pdfs all nicely downloaded into nicely dated folders. I told her I could code up a way to constantly grab it all from the website so she doesn't need to do 8 or 9 clicks for each upload they do.

Silly me because I can't even get AutoIt to login to the website.

Below is the following work in progress code:

#include <IE.au3>
 
$s_URL = "www.newsinslowspanish.com"
$s_User_ID = "login"
$s_Your_Password = "password"
 
$o_IE = _IECreate ($s_URL)
_IELoadWait ($o_IE)
 
$o_Login_Form = _IEFormGetCollection ($o_IE, 0)
$o_amember_login = _IEFormElementGetObjByName ($o_Login_Form, "amember_login")
$o_amember_pass = _IEFormElementGetObjByName ($o_Login_Form, "amember_pass")
_IEFormElementSetValue ($o_amember_login, $s_User_ID)
_IEFormElementSetValue ($o_amember_pass, $s_Your_Password)
 
#cs Just some of my failed attempts...
Attempt 1:
_IEAction ($o_amember_pass, "click")
Send ("{ENTER}")
 
Attempt 2:
_IEFormElementOptionSelect ($o_Login_Form, "Login", "byValue")
 
Attempt 3:
;_IEFormSubmit()
 
Attempt 4:
;_IELinkClickByText ($o_IE, "Login")
 
Attempt 5:
;_IELinkClickByIndex ($o_IE, 52)
 
Attempt 6:
; $o_Form_Login = _IEFormElementGetCollection ($o_Login_Form, 2)
; _IEAction ($o_Form_Login, "click")
#ce

At the moment IE fires up and enters in the login and password but I just can't get it to click on 'Login' or submit the form. I've tried a few variations on _IEFormSubmit() and figured the problem is due to some onclick Javascript as per the Remarks in the Help File.

For the life of me I tried more than the 6 different ways above but I just can't work it out.

Can someone please help with some code that will actually login but also explain to me why I haven't been able to figure this out so far? Clearly I don't know what I don't know. I've spent about 2 hours going through the Help File and trying different things so I'm coming here as a last resort.

Many thanks in advance for any help or pointers.

Kind regards,

icu

Link to comment
Share on other sites

You can try working with the widget properties of Login button. Sample code....assuming that login button has a name property (use _IEFormElementGetObjById if it has id property)

$o_loginbutton = _IEFormElementGetObjByName ($o_Login_Form, "namepropertyofloginbutton")

_IEAction($o_loginbutton, "click")

Link to comment
Share on other sites

icu, try this:

#include <IE.au3>
$s_User_ID = "login"
$s_Your_Password = "password"
$s_URL = "http://www.newsinslowspanish.com/amember/login.php?amember_login="&$s_User_ID&"&amember_pass="&$s_Your_Password
$o_IE = _IECreate ($s_URL)
_IELoadWait ($o_IE)
Link to comment
Share on other sites

Dear taietel,

Thank you this solution works perfectly!

How did you know that it needed the following line of code:

$s_URL = "http://www.newsinslowspanish.com/amember/login.php?amember_login="&$s_User_ID&"&amember_pass="&$s_Your_Password

..so I'll know when to use it in the future.

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...