How to inspect a pop-up coming up to enter login Crediantials

7,126 views
Skip to first unread message

Vishal G

unread,
Feb 6, 2014, 2:24:49 AM2/6/14
to seleniu...@googlegroups.com
Hi,

I am unable to inspect the pop up window that is coming to enter the login crediatials.
After that pop-up window everything gets disabled. I can't click anywhere else on the page. Nither the inspect element is working on it. No property list for this pop-up and no other options. The only thing the pop-up is allowing is to enter the "User Name:" and Password, click on "submit" or "Cancel" button.

Please suggest a way to enter the crediantials here through webdriver code and inspect the element on the pop-up.

Note: Control is directly coming to pop-up window. so i tried normal login code but it is not working. I also tried to switch the window. But I am not able to get the ID of the Pop-up window.

Please help and suggest the possibility.

Thanks-

 




ani0...@gmail.com

unread,
Feb 6, 2014, 2:41:10 AM2/6/14
to seleniu...@googlegroups.com
Just a quick guess...check the window handle id and do a switch to.let me know.

Sent from my BlackBerry10® on Airtel
From: Vishal G
Sent: Thursday 6 February 2014 1:00 PM
Subject: [selenium-users] How to inspect a pop-up coming up to enter login Crediantials

--
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/bd293818-c333-4d40-94c2-4c1dee107a18%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Pushpa Rathod

unread,
Feb 6, 2014, 3:20:33 AM2/6/14
to seleniu...@googlegroups.com

U cant inspect a js pop up.. u need to transfer webdriver control to alert box. To do so google for alert fr control transfer

Krishnan Mahadevan

unread,
Feb 6, 2014, 3:35:48 AM2/6/14
to Selenium Users
Vishal,
Looks like you are dealing with a SSO page [ Single Sign On] which prompts for your credentials the moment you login. The popup that comes is not a javascript popup [ which is what WebDriver can deal with] but is a browser popup.

You would need to :

1. Either employ tools such as AutoIT for dealing with the SSO popup (or)
2. Leverage firefox extensions which help you get past it.

 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


daniel anggrianto

unread,
Feb 6, 2014, 3:07:03 PM2/6/14
to seleniu...@googlegroups.com
I have the same issue when I was trying to pass authentication. WHat i did was i pass the username and password on the URL using something like this http://<username>:<password>@<URL>

kwok...@redairship.com

unread,
Mar 15, 2015, 10:18:26 PM3/15/15
to seleniu...@googlegroups.com
For those that are trying to pass the authentication, just take note, use 'https'. 

tulsi.tester

unread,
Mar 17, 2015, 8:25:18 AM3/17/15
to seleniu...@googlegroups.com
Hi All,

There are ways to handle HTTP authentication and HTTPS authentication.

1. If the URL pops up the HTTPS authentication while opening the URL you can do the following

driver.get("https:/USERNAME:PASSWORD@yourURL");

The above statement will not pop up the authentication window in Firefox and Chrome browsers. You need to do a little bit configuration for IE.


2. If the authentication pop up when you click a link on the web page. You can do the following. I am using the Robot class of Java

          //after clicking on an element, WAIT FOR SOME TIME TO POP UP THE AUTHENTICATION WINDOW

                  Thread.sleep(3000);

         //Now use robot class

        public void testRobot(){


Robot robot = new Robot();
setClipboardData("USERNAME");
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.delay(5000);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);

robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);

setClipboardData("PASSWORD");
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.delay(5000);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
               
                 Thread.sleep(5000);

         }

private static void  setClipboardData(String str){
StringSelection ss = new StringSelection(str);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
}


These two solutions worked for me.

tulsi.tester

unread,
Mar 17, 2015, 8:26:22 AM3/17/15
to seleniu...@googlegroups.com
Use double slash

driver.get("https://USERNAME:PASSWORD@yourURL");

bhavan...@gmail.com

unread,
Oct 30, 2018, 10:31:14 PM10/30/18
to Selenium Users
driver.get("https://USERNAME:PASSWORD@yourURL"); did work. Thanks Tulsi

Dhananjay Hanchate

unread,
Jun 24, 2019, 9:47:56 AM6/24/19
to Selenium Users
How to handle multiple auth pop ups ?
Using the above technique i am able to handle one pop up, but need a solution to handle one more auth pop up.

Thanks.


On Thursday, February 6, 2014 at 12:54:49 PM UTC+5:30, Vishal G wrote:

Akanksha Varshney

unread,
Sep 16, 2020, 2:18:17 AM9/16/20
to Selenium Users
Hey!
The authentication seems to work fine with this approach. Thanks!
I have a followup query - the URL that is supposed to be passed is a dynamic one and I am retrieving it after copying it from the main tab (and saving it in a variable)
Now if I try to pass the variable in place of URL here (https://<username>:<password>@<URL>), that simply doesn't work.
Thoughts on the workarounds?

Greg Banham

unread,
Nov 10, 2020, 2:47:16 PM11/10/20
to Selenium Users
To change focus to the pop up you can do this in Java:

var currentWindow = driver.getWindowHandle();
var allWindows = driver.getWindowHandles();

for(var i = 0; i < allWindows.size(); i++)
{
     if(currentWindow != allWindows.get(i))
     {
          driver.switchTo().window(allWindows.get(i))
     }
}
Note: this will only work if the driver instance has 2 tabs/windows open.

Getting the selectors if you can't right click and inspect element is a bit tricky. I went through the same scenario and guessed the id's as they was simply "username" etc. If that doesnt work then maybe after you pop up open, an element in there takes the focus, in which case you can d:

//This will probably be the username field, then you can just do "element.sendKeys(Keys.TAB)", then repeat the process of getting the active element in order to get the password field.
var element = driver.switchTo().activeElement();

Sai Krishna Pulivarthi

unread,
Nov 10, 2020, 9:49:43 PM11/10/20
to seleniu...@googlegroups.com
Hi,
Passing Username and Password in a URL is not a good practise. You are using a demo site.. to anyways if the right click menu is disabled and you cannot access inspect element, click on F12 on your keyboard to open DevTools of the page and from there you could easily find the attributes of your Login and Password fields to sendkeys the values using web driver.
For shifting focus to pop up, you can use the solution from Greg.. also you might wanna add some time for the chromedriver to wait for the pop to appear.

Thanks,
Sai

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

Uma Mahesh Reddy

unread,
Nov 11, 2020, 1:56:28 AM11/11/20
to seleniu...@googlegroups.com
Hii , 
 We can use Robot call.
Thanks,
Mahesh

Uma Mahesh Reddy

unread,
Nov 11, 2020, 1:58:33 AM11/11/20
to seleniu...@googlegroups.com
Robot robot=new Robot ();
Or
AutoIT class

On Wed, 11 Nov 2020, 01:17 Greg Banham, <gregb...@hotmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages