Jump to content

Auto Login to Website doesn't submit the form


Recommended Posts

We're working in a Citrix environment and in order to provision out access to a website I need to pre-populate the username and password so not everyone logging in gets this information.

So far I've gotten it so that it launches IE, opens the website I need access to, it quickly populates the username and password....... and then the IE screen flashes\refreshes and I'm sitting at the same screen with the username populated. Password field is now blank.

It doesn't indicate that the user\pass is incorrect. (and trust me it would). It's almost as if the screen does a refresh. But I don't know why. Any thoughts?

I even thought that it was refreshing due to some sort of IE loading thing. So I copied the block of code to populate and submit the form, and I watched as the IE browser flashes\refreshes twice in a row and still doesn't log me in. Did I do something wrong in the submitting of the form?

(and yes there is a splash screen that must load prior to the launch, which is what you see at the top of the code)

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       WinVista/Win7
; Author:         Josh
;
; Script Function: 3000xtra auto-login



#include <IE.au3>

$image = "C:\SplashScreen\CGALogo2.jpg"

SplashImageOn("Splash Screen", $image, 524, 350, -1, -1, 1)
Sleep(5000)
SplashOff()


$user = "email@email.com"    ;<<< Change username
$pass = "******"        ;<<< Change password
$url = "https://portal.hpd.global.reuters.com/auth/login.aspx" ;<<< Change webpage link
$oIE = _IECreate ($url)
_IELoadWait ($oIE)

$uForm = _IEFormGetObjByName ($oIE, "_form")   ;<<< Change to form html name on webpage
$uText = _IEFormElementGetObjByName ($uForm, "_layout$_main$_mainControl$_usernameTextBox")   ;<<< Change to input name of username field box within form on webpage
_IEFormElementSetValue ($uText,$user)

$pText = _IEFormElementGetObjByName ($uForm, "_layout$_main$_mainControl$_passwordTextBox")  ;<<<Change to input name of password field box within form on webpage
_IEFormElementSetValue ($pText,$pass)
_IEFormSubmit ($uForm)
Link to comment
Share on other sites

If you comment out the _IEFormSubmit() at the end does it properly set the username/password, and work correctly if you manually click OK after that?

By looking at the form inputs with a DOM inspector you might find some onEvent scripts (i.e. "onkeypress") attached to them that your automation doesn't trigger.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

If you comment out the _IEFormSubmit() at the end does it properly set the username/password, and work correctly if you manually click OK after that?

By looking at the form inputs with a DOM inspector you might find some onEvent scripts (i.e. "onkeypress") attached to them that your automation doesn't trigger.

;)

Thanks for the suggestion Psalty. If I modify the code to take out the IEFormSubmit function, everything else works to that point and I can click ok\submit and get into the software. So for the moment that's a good work around.

Can anyone do me a favor and look at the source code of https://portal.hpd.global.reuters.com/auth/login.aspx and let me know if there's something I missed on the form submit side of things? I'd still really like to have it just jump right into the app as this way the username isn't seen either. But at least this is a good temporary solution.

Link to comment
Share on other sites

Look at Example No.2 under _IEAction(). Get the object reference to the button, set focus to it with _IEAction(), then ControlSend() an "{ENTER}" to it.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...