Jump to content

Firefox HTTP authentication


Arunsomu
 Share

Recommended Posts

Hi guys

I am automating the application in both IE and firefox. The application has HTTP authentication dialog where I completely automated this for IE and I got success on that.Please view the script which I used in IE.

#include <IE.au3>

$o_Addy = "http://myurl.com/"

$Title = "Connect to myurl.com"

$username = "john"

$password = "smith"

_IENavigate("", $o_Addy, 0)

AutoItSetOption("WinTitleMatchMode","2")

WinWait($Title)

$title = WinGetTitle($Title) ; retrives whole window title

ControlSend($title,"","Edit2",$username);Sets User Name

ControlSend($title,"","Edit3",$password)

ControlClick($title,"","OK")

I have to repeat the same for Firefox. When I used AutoIT window info I am able to see only the title as "Authentication Required" and class as "Mozilla Dialog class". I do not see control ids for username, password and Ok button.

How can I automate this authentication dialog in firefox. Can anyone please give your suggestions on this?

Link to comment
Share on other sites

Yep, that UDF is the way to go :x. Additionally FF allows adding username and password to the URL, something like http://USERNAME:PASSWORD@www.website.com/protected_dir/ ,but then a confirmation dialog pops-up (should be easy to catch).

Link to comment
Share on other sites

Thanks kaFu and Comd for your replies. Can you please give me more details on this.

I am unable to use http://username:password@www.website.com since my password contains numbers, special characters so it is not recognized.

I would like to know can I use any simple autoIT script to automate this?

Please refer the attached screenshot where I can get only title and window information about the authentication window.

Title : Authentication Required

Class : MozillaDialogClass

I do not have any controls available for username , password and ok buttons.

Please give your suggestions to resolve this.

post-61671-0-17497000-1293691727_thumb.j

Link to comment
Share on other sites

  • 2 years later...

hello , did you find any solutions for the 'Authentication required' window with AutoIt ?  I have the same Issue as in you're screenshot . 

Question : What programming language do you use Java ? cause I see the   #include <IE.au3> command ? is there a framework that you can include with you're Junit Test using java , I have dealed with an authentification and solved by execution of a java process which contains the Exe. of an AutoIt script.

Best regards, Ionut Emilian Moldovan. :bye:

Link to comment
Share on other sites

This is how I did it , finally , and it work perfectly for me:

 

1) Step 1 - creating a autoIt Script (au3)  , with the below code ( where userid and password is you're authentication details, change that )

 

WinWaitActive("Authentication Required","","10")

WinFlash("Authentication Required", "",4,500)

 If WinExists("Authentication Required") Then

 Send("userid{TAB}")

 Send("password{Enter}")

 EndIf

 

2) Step 2 - convert the (au3) script into an EXE with 'Compile Script' tool from AutoIt

 

3) Step 3 - when the authentication window appears , execute the  'EXE' file ,  ( I did it within a java process )

 

Hope it works for you also ,  

 

more details are provided here : http://automationtestingsimplified.wordpress.com/2011/08/11/how-to-handle-window-based-pop-up-using-selenium-and-autoit/

 

 

NOTE:

It's only for FF (because on the other browser it has another TITLE )

<snip>

For more info , please feel free to contact me   ;)

Edited by Melba23
Removed upload link as it has not been uploaded

Best regards, Ionut Emilian Moldovan. :bye:

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