Sign in to follow this  
Followers 0
covaks

Login dialog in Firefox

5 posts in this topic

Has anyone found a way to work on a firefox login dialog window (see pic)? I've looked around the forums, and seen a few other people asking (eg: ) but haven't seen an answer yet. FF_Autologin doesn't seem to work on this, as it's not an HTML page and there is no id/name/etc for it to target, and all the topics covering logins I've seen assume that is the case. Is it even possible to use FF.au3 to automate a login dialog window, with no html forms for the functions to target?

I've attached a pic of the window I'm trying to login too. Right now the only way I can do it is with this:

#include "FF.au3"
opt("WinSearchChildren",1)

_FFConnect()
_FFOpenURL("http://site",False)
WinWait("Authentication Required")
WinActivate("Authentication Required")
ControlClick("Authentication Required","","","Left",1,85,60)
Send("Username")
ControlClick("Authentication Required","","","Left",1,85,83)
Send("password")
;..etc

Obviously I don't like doing it this way. Unfortunately the only info you can get from the window is "MozillaWindowClass1".

post-19720-0-35511600-1296875531_thumb.j

Share this post


Link to post
Share on other sites



Hi, I just signed up because I found this topic when I was looking for a solution to my problem.

My wife often uses Bookmooch, a website that uses that same window to log in. So whenever we start Firefox, and the last session is re-opened, we have to wait until that pop up comes up and we can hit Enter. Very annoying.

Does the above bit of code help us get rid of this? How does it work, do I have to save that code as a userscript (we have Greasemonkey) or is it something else entirely? Sorry, I'm not into programming.... If you can help me, would be great!

erik

Share this post


Link to post
Share on other sites

Hi, welcome to AutoIT :-)

The code in the first post wasn't really a working sample, it was just to show the idea. Here is something you can try to start with though:

First, Install AutoIT and SCiTE (get them here), and start a new script (after you install AutoIT open the help and do the tutorials, they really help explain a lot, and are very quick to do. At the very least, _do_ the hello world and notepad automation tutorial, read through the others if you can).

In a new script, paste this in:

opt("WinSearchChildren",1)

$Title = "Authentication Required"
$Username = "Username"
$Password = "password"

While 1
    If WinActive($Title) Then
        ControlClick($Title,"","MozillaWindowClass1","Left",1,85,60)
        Send($Username,1)
        ControlClick($Title,"","MozillaWindowClass1","Left",1,85,83)
        Send($Password,1)
        Send("{ENTER}")
    EndIf
    Sleep(2000)
WEnd

Read that over, look in the Help Files for the commands (ControlClick, WinActive, Opt, etc..) and see if you can figure out what it does.

Edit these three lines:

$Title = "Authentication Required"
$Username = "Username"
$Password = "password"

The username and password need to be the user/pass you use to login. And "Authentication Required" is the title of the dialog window.. If it's the same title, then you can just leave it.

Also, about this:

ControlClick($Title,"","MozillaWindowClass1","Left",1,85,60)

I've attached a screenshot to show a bit about how I got this information.

Try running that (in SCiTE go Tools > Go.. Or Compile to executable, then run the executable). And then open firefox and connect to the Bookmooch site where it brings up the login. If all goes well, it should automatically log you into the site. It continually loops, and every two seconds it looks to see if the "Authentication Required" window is active (or whatever you change the title too, if it's different for you). If it see's that window, it then tries to click on where the Username box should be, and then send the keystrokes for your username. Then it should click a little lower, aiming for the password box this time, and try to send your password, and finally it should send an enter key to login.

Let us know if you run into any problems or have any questions. Maybe see if you can modify it to also launch the browser window.. You could have a shortcut on your desktop for example that runs this program, and it would bring up your browser and automatically log you in. Keep in mind too that this isn't very secure... So you wouldn't want to use something like this in a public place or let anyone else get a hold of it.

post-19720-0-86079900-1297442548_thumb.j

Share this post


Link to post
Share on other sites

I came across this problem too in my testing. This thread provided some useful ideas but ultimately didn't work for me as in FF6.0.2 the AutoIt window info showed no control info for the user and password fields.

The simple workaround i came up with was to use keypresses to enter the text, tab through the controls on the dialog and hit okay

;~ ------------------------------------------------------------
;~ Usage: autoit_login.exe "DlgTitle" "User Name" "Password"
;~ ------------------------------------------------------------
AutoItSetOption("WinTitleMatchMode","2")
WinWait($CmdLine[1]) ; match the window with the provided DlgTitle substring

$user = $CmdLine[2];
$pass = $CmdLine[3];
$logintitle = WinGetTitle($CmdLine[1]) ; retrieves the full window title

WinActivate($logintitle)

;~ Use keypresses to enter the fields. In FF6, the user field automatically has focus
Send ($user); Set the username
Send ("{TAB}"); Tab into password field
Send ($pass ); Set the password
Send ("{TAB}"); Tab onto the OK button
Send ("{ENTER}"); Press enter to hit OK button, closing the dialog and completing login

Share this post


Link to post
Share on other sites

beglee,

Welcome to the AutoIt forum. :)

But please read the Forum Rules before you post again - they have changed since this thread was started a year ago and we no longer permit discussion of site login methods, among other things. ;)

Once you are fully aware of the rules, I hope we see you again before too long. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0