Handling Authentication Popup

213 views
Skip to first unread message

Anita Chaudhary

unread,
Jul 7, 2015, 3:57:05 AM7/7/15
to seleniu...@googlegroups.com
Hi,
I am unable to handle the authentication popup, which is there in  Dynamic CRM.
please help me out.

Gautam Srivastava

unread,
Jul 7, 2015, 4:03:39 AM7/7/15
to seleniu...@googlegroups.com
Hi,

Try using this : http://username:pass...@site.com/page

Instead of : http://site.com/page

e.g:-

WebDriver driver = new FireFoxDriver();
driver.get("http://username:password@URL");

2) The Alert Method, authenticateUsing() lets you skip the Http Basic Authentication box.

After opening the webdriver URL:-

WebDriverWait wait = new WebDriverWait(driver, 10);
Alert alert = wait.until(ExpectedConditions.alertIsPresent());
alert.authenticateUsing(new UserAndPassword("USERNAME", "PASSWORD"));

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/19fc2b81-049f-4a5e-bd15-4d2dc03bcf9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks and Regards
Gautam Srivastava

SDET | Snap Step Services & Solutions Pvt. Ltd.
(Bangalore)

Anita Chaudhary

unread,
Jul 8, 2015, 4:26:54 AM7/8/15
to seleniu...@googlegroups.com

I have used the below methods but enable to handle the popup.

The below code i have used here:
package com.example.tests;

import org.openqa.selenium.Alert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Untitled {
    public static void main(String[] args) {
WebDriver driver= new FirefoxDriver();
String URL = "http://administrator:P@ssw0rd!@192.168.1.29/dcrm";
    driver.get(URL);
    Alert alert = driver.switchTo().alert();
    alert.accept();
}
}


Please help me out with this issue.
Site is opening but its not taking the user name and password.
Screen shot is attached for reference.
Screenshot_1.png

Ask QTP

unread,
Jul 8, 2015, 4:53:00 AM7/8/15
to Anita Chaudhary
This is window authentication..autoIT will help you

Sent from my BlackBerry 10 smartphone.
From: Anita Chaudhary
Sent: Wednesday 8 July 2015 13:57
Subject: [selenium-users] Re: Handling Authentication Popup

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

Kaleem Uddin Mohammed Abdul

unread,
Jul 12, 2015, 2:38:36 AM7/12/15
to seleniu...@googlegroups.com
Exactly AutoIT should be able to help. I automated this authentication pop-up in C#. The below is the code snippet.

 try
           {
               IAutoItX3 Autoit = new AutoItX3Class();
               int Counter = 1;
               Autoit.AutoItSetOption(Constants.AutoITMatchMode, 2);
               Autoit.WinWait(Constants.MozillaModalWindowName, string.Empty, 2);
               while (Counter <= 5)
               {
                   if ((Autoit.WinExists(Constants.MozillaModalWindowName) != 0))
                   {
                       Autoit.WinActivate(Constants.MozillaModalWindowName);
                       Autoit.Send(_Constants.UserName);
                       Autoit.WinActivate(Constants.MozillaModalWindowName);
                       Autoit.Send(Constants.TabKey);
                       Autoit.WinActivate(Constants.MozillaModalWindowName);
                       Autoit.Send(_Constants.Password);
                       Autoit.WinActivate(Constants.MozillaModalWindowName);
                       Autoit.Send(Constants.EnterKey);
                       break;
                   }
                   System.Threading.Thread.Sleep(1000);
                   Counter++;
               }
               _WebDriver.Manage().Window.Maximize();
           }
           catch(Exception Ex)
           {
               throw Ex;

Alexander R

unread,
Jul 12, 2015, 6:03:39 PM7/12/15
to seleniu...@googlegroups.com
Anita,
Please open IE and try to add the site to local intranet.

మహేంద్ర రెడ్డి

unread,
Jul 12, 2015, 11:17:35 PM7/12/15
to seleniu...@googlegroups.com
Hi,

I have no idea if thit will work, Below one not fully implemented for any driver yet, but there is a way to switch to an alert using WebDriver.

Alert alt= driver.switchTo().alert();

alt.authenticateUsing(new UserAndPassword("UserName","Password"));

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8a62558d-f906-4434-992e-e77092613af7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks & Regards,

Mahendra Reddy  P,

Mob: +91-8106611476

Skype: P_MahendraReddy

మహేంద్ర రెడ్డి

unread,
Jul 12, 2015, 11:22:24 PM7/12/15
to seleniu...@googlegroups.com
Hi Alexander,

I have also same problem in IE browser and added server user in local internet sites as you said but still i am getting same issue

If any other solution please help me.


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

For more options, visit https://groups.google.com/d/optout.

vasanth kumar

unread,
Jul 15, 2015, 11:44:52 AM7/15/15
to seleniu...@googlegroups.com
Hi 

i have successfully handled this problem with AutoIT.. 

but you need to install the AutoIT where your code is running . you can refer the following URL For that 


but problem is every time you need to manually close the autoit.exe process in taskbar.. no idea how to handle that .

if any body have idea please let me know..
Reply all
Reply to author
Forward
0 new messages