Jump to content

Web Page Login


Recommended Posts

Is it possible to automate the login process to a web page, that is where a web page comes up with a login box requesting a user name and a password and a ok or submit button, can a script be written to pass in the required username and password then click on the ok or submit button of the page, this would be carried out on an internal network where the use logs into a specific page on the internal intranet.

Also is it possible to write a script to do the same thing with a program that is made to run at startup of a computer, once the computer starts is it possible to pass in a username and password to log into a program, for example where the computer is not attended and requires to be logged into a program again on a reboot. Any assistance would be appreciated, and pointers to example code which may help me would be very much appreciated.

Link to comment
Share on other sites

Open the autoit Window info tool and check to see if you can get any information from the login form on the webpage. If you can't then you probably won't be able to automate it without using manual mouseclicks and stuff.

On the other hand for a normal windows login form, you can use the window tool to get the title of the window, the controlID's for the buttons and input boxes and after doing so can use a combination of the commands

WinWaitActive("title of window here")
ControlCommand("windowTitle","windowText","controlID here","EditPaste","the string you want to paste") ;for sending text to input boxes
ControlClick("windowTitle,"windowText","controlID")

Hope this makes sense

Dave.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------"I don't need to know everything, I just need to know where to find it when I need it"....EinsteinAnd in our case... That's the AutoIT helpfile ;) Please read before posting!!!

Link to comment
Share on other sites

You can also create a program that opens the page you are logged on...

Case $msg = $btn_ok
    $user = "(USERNAME)"
            $pass = "(PASSWORD)"
    If GUICtrlRead($in_username) = "" Then
        MsgBox(0, "Wrong", "Fill in the fields required", 3)
    ElseIf GUICtrlRead($in_pass) = "" Then
        MsgBox(0, "Wrong", "Fill in the fields required", 3)
    ElseIf GUICtrlRead($in_username) <> $user Then
        MsgBox(0, "error", "Wrong Username", 3)
    ElseIf GUICtrlRead($in_pass) <> $pass Then
        MsgBox(0, "error", "Wrong Password", 3)
    Else
      ShellExecute("(THE LOGGED IN PAGE [something confusing and big] )")
EndIf

EDIT: autoit tags...

Edited by c4nm7
Link to comment
Share on other sites

Is it possible to automate the login process to a web page, that is where a web page comes up with a login box requesting a user name and a password and a ok or submit button, can a script be written to pass in the required username and password then click on the ok or submit button of the page, this would be carried out on an internal network where the use logs into a specific page on the internal intranet.

Also is it possible to write a script to do the same thing with a program that is made to run at startup of a computer, once the computer starts is it possible to pass in a username and password to log into a program, for example where the computer is not attended and requires to be logged into a program again on a reboot. Any assistance would be appreciated, and pointers to example code which may help me would be very much appreciated.

This is what IE.au3 is all about (look in the helpfile for User Defined Functions -> IE Management).

See the _IEFormElementSetValue function -- the helpfile has an example of using it to login to Hotmail with ~8 lines of code.

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

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