Handle Windows Authentication Dialog using Selenium Webdriver

14,724 views
Skip to first unread message

sanam

unread,
Mar 14, 2012, 2:35:03 AM3/14/12
to seleniu...@googlegroups.com
Hi,

       I have handled the Windows Authentication Dialog in Selenium RC using AutoIT and it works fine for the browsers IE,FF and chrome.However I am trying to achieve this using Webdriver. 

How can this be done? is there a function like driver.switchTo().prompt and then we can enter the user id and password ??

Mallikarjun Yalagi

unread,
Mar 14, 2012, 2:40:35 AM3/14/12
to seleniu...@googlegroups.com
Hi sanam,
 
         did you handled Autocomplete Passwords in IE,i mean dialog box like when you click on login button,whether to save password or not ??
 
Thanks&Regards
Mallikarjun Yalagi

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/h9QvTCt7Pm8J.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Jayaraman - Inspired to become Software Architect

unread,
Mar 14, 2012, 3:02:03 AM3/14/12
to seleniu...@googlegroups.com
Yes you can..
 
Pls have a look on this
 
-Jay!!

On Wed, Mar 14, 2012 at 12:05 PM, sanam <sanam...@qualitiasoft.com> wrote:
--

Jayakumar C

unread,
Mar 14, 2012, 3:57:17 AM3/14/12
to seleniu...@googlegroups.com, webd...@googlegroups.com
@Sanam,

Handling of such  'HTTP Basic Authentication' dialogs are not yet supported by webdriver. Hence, driver.switchTo() and the below mentioned link won't be helpful.

You still need AutoIt to bypass the dialog.
(OR)
You might consider trying out the tricks like, passing the username and password in the URL itself, editing the windows registry(for IE).
(Hint: Search on Google / this group )
--
Jayakumar

Jayaraman - Inspired to become Software Architect

unread,
Mar 14, 2012, 6:30:56 AM3/14/12
to seleniu...@googlegroups.com
@Jayakumar,
 
Thanks for helping me to get a clear understanding.
 
@Sanam, 
 
I tried a same scenario and I couldn't handle that window authentication dialog using driver.switchTo() API [As Jayakumar mentioned]
 
Sorry for my mistake.
 
-Jay!!

sanam

unread,
Mar 15, 2012, 1:38:44 AM3/15/12
to seleniu...@googlegroups.com
Thanks for your response everyone. So i am guessing even the DownLoad window will not be supported and will have to continue using AutoIt for it. This is kinda a put off.

@ Mallikarjun  : No i have not handled that. Maybe you can try driver.switchTo().alert but before doin this you may have to do a driver.switchTo.window(hanlde) to select the page on which this pop up is displayed.

Thanks,
Sanam


To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
--
Jayakumar

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Nischand

unread,
Apr 19, 2012, 7:04:02 AM4/19/12
to webd...@googlegroups.com, seleniu...@googlegroups.com

Hi Jaykumar,

you can use like this to bypass Authentication


         FirefoxProfile profile = new FirefoxProfile();
         profile.setPreference("network.http.phishy-userpass-length", 255);
         profile.setPreference("network.automatic-ntlm-auth.trusteduris","google.com");
         FirefoxDriver webDriver = new FirefoxDriver(profile);
   
         webDriver.get("http://USNME:PASWD@FullURL/");



After this u will bypass authentication.and goes to normal page !!!!
           

On Wednesday, March 14, 2012 7:57:17 AM UTC, Jayakumar C wrote:
@Sanam,

Handling of such  'HTTP Basic Authentication' dialogs are not yet supported by webdriver. Hence, driver.switchTo() and the below mentioned link won't be helpful.

You still need AutoIt to bypass the dialog.
(OR)
You might consider trying out the tricks like, passing the username and password in the URL itself, editing the windows registry(for IE).
(Hint: Search on Google / this group )


On 14 March 2012 12:32, Jayaraman - Inspired to become Software Architect <electri...@gmail.com> wrote:
Yes you can..
 
Pls have a look on this
 
-Jay!!

On Wed, Mar 14, 2012 at 12:05 PM, sanam <sanam...@qualitiasoft.com> wrote:
Hi,

       I have handled the Windows Authentication Dialog in Selenium RC using AutoIT and it works fine for the browsers IE,FF and chrome.However I am trying to achieve this using Webdriver. 

How can this be done? is there a function like driver.switchTo().prompt and then we can enter the user id and password ??

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/h9QvTCt7Pm8J.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.



--
Jayakumar

On Wednesday, March 14, 2012 7:57:17 AM UTC, Jayakumar C wrote:
@Sanam,

Handling of such  'HTTP Basic Authentication' dialogs are not yet supported by webdriver. Hence, driver.switchTo() and the below mentioned link won't be helpful.

You still need AutoIt to bypass the dialog.
(OR)
You might consider trying out the tricks like, passing the username and password in the URL itself, editing the windows registry(for IE).
(Hint: Search on Google / this group )


On 14 March 2012 12:32, Jayaraman - Inspired to become Software Architect <electri...@gmail.com> wrote:
Yes you can..
 
Pls have a look on this
 
-Jay!!

On Wed, Mar 14, 2012 at 12:05 PM, sanam <sanam...@qualitiasoft.com> wrote:
Hi,

       I have handled the Windows Authentication Dialog in Selenium RC using AutoIT and it works fine for the browsers IE,FF and chrome.However I am trying to achieve this using Webdriver. 

How can this be done? is there a function like driver.switchTo().prompt and then we can enter the user id and password ??

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/h9QvTCt7Pm8J.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.



--
Jayakumar

Marcel Newton

unread,
Apr 25, 2014, 5:33:12 PM4/25/14
to seleniu...@googlegroups.com
Hello i have the same bugg as ou on IE/Chrome and i have no idea on how to solve it.

Did you find a solution ?

Do you have sample to share ?

I will be working on it and if i find a solution i will post a code sample here . If it waste a lot of time i might start thinking to switch to a FormAuthentication ...

thanks i advance



On Saturday, 18 May 2013 20:23:01 UTC-4, Seema Singh wrote:
Hi Karthik,
I am not able to handle authentication required pop up window by using webdriver.
request you to pls share a sample code.

Thanks,
Seema

Siva kumar

unread,
May 14, 2014, 3:03:43 AM5/14/14
to seleniu...@googlegroups.com, webd...@googlegroups.com
Hi Jayakumar,
Thanks for the information,but i am not able to enter username and password the authentication pop up boxes,could u reply..
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.



--
Jayakumar

On Wednesday, March 14, 2012 7:57:17 AM UTC, Jayakumar C wrote:
@Sanam,

Handling of such  'HTTP Basic Authentication' dialogs are not yet supported by webdriver. Hence, driver.switchTo() and the below mentioned link won't be helpful.

You still need AutoIt to bypass the dialog.
(OR)
You might consider trying out the tricks like, passing the username and password in the URL itself, editing the windows registry(for IE).
(Hint: Search on Google / this group )


On 14 March 2012 12:32, Jayaraman - Inspired to become Software Architect <electri...@gmail.com> wrote:
Yes you can..
 
Pls have a look on this
 
-Jay!!

On Wed, Mar 14, 2012 at 12:05 PM, sanam <sanam...@qualitiasoft.com> wrote:
Hi,

       I have handled the Windows Authentication Dialog in Selenium RC using AutoIT and it works fine for the browsers IE,FF and chrome.However I am trying to achieve this using Webdriver. 

How can this be done? is there a function like driver.switchTo().prompt and then we can enter the user id and password ??

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/h9QvTCt7Pm8J.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.



--
Jayakumar

Doug Dragon

unread,
May 14, 2014, 1:49:45 PM5/14/14
to seleniu...@googlegroups.com, webd...@googlegroups.com
Something like this isn't going to work using Selenium because it's not actually part of the DOM. You can interact with Alerts, but not auth prompts.

Hope that helps,

-Doug

Alan Holt

unread,
May 16, 2014, 10:13:29 PM5/16/14
to seleniu...@googlegroups.com
I just got done with a prototype project that should be able to do what you describe.  It utilizes the BrowserMob proxy to post the authentication to the web browser, instead of having to edit the registry or use an extension.  It is still in its alpha stage, but maybe it will help you.  https://sourceforge.net/projects/seleniumbasicauthwrapper/?source=navbar

It is using C# WebDriver, but if you are using Java, BrowserMob actually has a very verbose integration with WebDriver, so maybe that would be a good direction to go.  Hope this helps!

Venky Ch

unread,
Aug 12, 2014, 4:59:52 AM8/12/14
to seleniu...@googlegroups.com
Hi Sanam,
 
I am working on Selenium RC. So could you please share the code for Windows Authentication Dialog in Selenium RC using AutoIT and it works fine for the browsers IE.
 
Regards,
Venkat

DongXiang

unread,
Aug 13, 2014, 4:43:00 AM8/13/14
to seleniu...@googlegroups.com
Hi ,

Web driver can't handle platform dialog like authentication dialog, modal dialog. AutoIt rely on the operation platform and can't be executed on different operation system. JRobot may be a solution, but it rely on the focus. it may different for different browsers. From my test, it works for most browsers.

Best Regards,
--david


Date: Tue, 12 Aug 2014 01:59:52 -0700
From: chundu...@gmail.com
To: seleniu...@googlegroups.com
Subject: [selenium-users] Re: Handle Windows Authentication Dialog using Selenium Webdriver
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

Sadipan Bhattacharjee

unread,
May 5, 2015, 5:50:03 PM5/5/15
to seleniu...@googlegroups.com
Hi, I used Java threads, awt robots along with Selenium webdriver to address to automate windows authentication process of our website. This is basic but worked for me!
If you have suggestions or feedback please let me know.

//...
//Note: this logic works in Chrome and Firefox. It did not work in IE and I did not try Safari.
//...

//import relevant packages here

public class TestDemo {

   
static WebDriver driver;

   
public static void main(Strings{} args) {

       
//setup web driver
       
System.setProperty("webdriver.chrome.driver", "path to your chromedriver.exe");
        driver
= new ChromeDriver();

       
//create new thread for interaction with windows authentication window
       
(new Thread(new LoginWindow())).start();                

       
//open your url. this will prompt you for windows authentication
        driver
.get("your url");
   
       
//add test scripts below ...
        driver
.findElement(By.linkText("Home")).click();    
       
//.....
       
//.....
       
//.....
       
//.....

   
}

   
//inner class for Login thread    
   
public class LoginWindow implements Runnable {
       
       
@Override
       
public void run() {
           
try {
                login
();
           
} catch (Exception ex) {
               
System.out.println("Error in Login Thread: " + ex.getMessage());
           
}
       
}
               
       
public void login() throws Exception {
           
           
//wait - increase this wait period if required
           
Thread.sleep(5000);
           
           
//create robot for keyboard operations
           
Robot rb = new Robot();

           
//Enter user name by ctrl-v
           
StringSelection username = new StringSelection("username");
           
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(username, null);            
            rb
.keyPress(KeyEvent.VK_CONTROL);
            rb
.keyPress(KeyEvent.VK_V);
            rb
.keyRelease(KeyEvent.VK_V);
            rb
.keyRelease(KeyEvent.VK_CONTROL);

           
//tab to password entry field
            rb
.keyPress(KeyEvent.VK_TAB);
            rb
.keyRelease(KeyEvent.VK_TAB);
            Thread.sleep(2000);

           
//Enter password by ctrl-v
           
StringSelection pwd = new StringSelection("password");
           
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(pwd, null);
            rb
.keyPress(KeyEvent.VK_CONTROL);
            rb
.keyPress(KeyEvent.VK_V);
            rb
.keyRelease(KeyEvent.VK_V);
            rb
.keyRelease(KeyEvent.VK_CONTROL);
           
           
//press enter
            rb
.keyPress(KeyEvent.VK_ENTER);
            rb
.keyRelease(KeyEvent.VK_ENTER);
           
           
//wait
           
Thread.sleep(5000);
       
}                        
   
}      
}


Reply all
Reply to author
Forward
0 new messages