SELENIUM BASICS:


SELENIUM WEBDRIVER:


TESTNG:


REPORTS:


BUILD & CONTINUOUS INTEGRATION TOOLS:


CROSS BROWSER TESTING:


MOBILE TESTING:


AUTOMATION FRAMEWORKS:


API Testing:


INTERVIEW QUESTIONS:


SAMPLE RESUME:

How To Handle Authentication Popup Window Using Selenium WebDriver

Handling Authentication Popup Window:

In this post, we see how to handle Authentication Popup using Selenium WebDriver.

What is Authentication Popup window and why these Authentication Popup windows showed up while opening few websites.

Authentication popup window looks like the below mentioned image.

Authentication Popup Window

Let’s see “How To Handle Authentication Popup using Selenium WebDriver”:

Companies have their own proxy settings to access some servers. If you open a server in the browser a popup window will load and force you to enter user credentials to do login to access the server. Even while accessing the same server using selenium script we need to handle the popup before hand accessing the server. If we can’t handle this, we couldn’t do further testing.

We could handle this type of authentication pop up in multiple ways. Let’s see in detail.

Approach 1: Handling Authentication/Login Popup Window using Selenium WebDriver

By passing user credentials in URL. Its simple, append your username and password with the URL.

e.g., http://Username:Password@SiteURL

http://rajkumar:myPassword@www.softwaretestingmaterial.com

here, Username is rajkumar
Password is myPassword
SiteURL is www.softwaretestingmaterial.com

Sample code:

Approach 2: Handling Authentication/Login Popup Window using Selenium WebDriver

By using AutoIt, we could handle authentication pop up.

Also Read:

How to download file Using AutoIt

How to upload file using AutoIt

Sample AutoIT Script:

Sample Java Code:

Approach 3: Handling Authentication/Login Popup Window using Selenium WebDriver

By using Alerts in Selenium, we could handle authentication pop up.

 

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

2 thoughts on “How To Handle Authentication Popup Window Using Selenium WebDriver”

  1. I am working in banking project.I am unable to switch to window which is required for higher authorisation.
    Following are steps
    1. Login to application
    2.Do payment transaction
    3. Window displays on same the page generating number which needs to be captured.
    I am unable to do 3rd step
    I have tried driver.switchto().Window(handle)

  2. HI,
    I am trying the secodn approach it works fine with Firefox and IE but not teh chrome, For chrome The window title shows Sign in and i built autoit script for the same.

    WinWaitActive(“Sign in “,””,”20″)
    If WinExists(“Sign in “) Then
    Send(“qatest”)
    Send(“{TAB}”)
    Send(“test123”)
    Send(“{ENTER}”)
    EndIf

    Please help how to handle windows authentication for chrome

Leave a Comment

Your email address will not be published. Required fields are marked *

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook

DOWNLOAD FOR FREE