Jump to content

Recommended Posts

Posted

Hello,

Does anyone have a suggestion as to how I might use AutoIt to logon to a website?

I looked at RunAsSet, but that seem to just launch IE as me.

I have a webpage that does DB queries and in my absence I want to give my backup a way to run those queries without actually giving him my domain password. I was hoping to find a method to launch IE and pass the credentials at the same time. Humm that makes me think, I wonder if I could do it as a two step process.

1) Launch IE and wait for login popup.

2) Click a button that looks for the popup window and passes my credentials.

Hummm....just not sure.

Any thoughts?

Thanks,

-Mike

Posted (edited)

Hello you could start with this:

Execute("http://sitename.com")

WinExists("Popupdialog name")
WinActivate("Popupdialog name")

; Here you could might use control click or
; _IELinkClickByText  or
; _IELinkClickByText I think

Regards

EDIT: Which homepage is it? then we could might help you a little more

Edited by newbiescripter
Posted

Since you don't want your backup to have your credentials in any way. I would suggest first to do an _IEAttach on the popup window and then finding the input fields by using _IEFormElementGetObjByName (). The below example is what is from the help file for _IEFormElementGetObjByName() function.

#include <IE.au3>

$oIE = _IECreate("http://www.websitetologin.com") ;or
$oIE = _IEAttach("Login Popup") ;the title of the login popup window
$oForm = _IEFormGetCollection ($oIE, 0) ;Get the first Form in the page (0)
$oUsername = _IEFormElementGetCollection ($oForm, 0) ;Get the first input field in the form (Username)
_IEFormElementSetValue ($oUsername, "MyUsername") ;Set the field value
$oPassword = _IEFormElementGetCollection ($oForm, 1) ;Get the second input field in the form (Password)
_IEFormElementSetValue ($oPassword, "MyPassword") ;Set the field value
_IEFormSubmit ($oForm) ; Submit the form ;)

You can use Debugbar to find the name of the form and form elements. This would be the best way to ensure that your information is not copied to other places.

Debugbar can be found on the signature of Master Dale Hohm the creator of IE.au3 library functions :).

Post back with your results if you need more help :(

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
  • Recently Browsing   0 members

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