Make Selenium Easy

Handling Window Authentication in Chrome Using Selenium WebDriver

Authentication is a process for verifying the identity of an object. Let’s consider that object as a website here. When we load URL of a website then that website may ask you to authorize yourself before getting access to its content. One of the authentication method is Window Authentication. It is also called as basic authentication. Something as below :-

Handling window authentication in Selenium WebDriver is tricky. Mostly people understand authentication pop up as a Javascript alert and try by switching to it using Alert interface. Everything that pops up , is not a Javascript alert.

However, Selenium 3.4.0 version added a new method named authenticateUsing() in Alert interface to authenticate these authentication pop up but it was not successful and removed from later versions.

Reference –

There are some solutions to it with certain limitations :-

  1. By using third party tools such as Sikuli and AutoIt. These solutions have limitations like Sikuli will not work on Jenkins if headless. AutoIt is only for windows and have problem in running on Jenkins.
  2. Passing or encoding username and password within URL as http://username:password@url mostly works for a non secure websites (http) and fails for secure sites (https).

Manually whenever you load that URL you may need to enter username and password every time which is pain. You may be access of multiple such websites and remembering credentials for each is not possible. A browser extension can help you to remember these credentials and grant access automatically when you access such websites. Something like password management of any browser.

You can handle authentication pop up in Chrome browser using Multipass extension provided by chrome. In this extension we can setup username and password for a URL in advance so that whenever you launch that URL then it will not ask you to authorize. The same extension is available for Firefox and Opera as well.

Learn here to add a chrome extension manually and using Selenium WebDriver in simple steps here.

Steps to handle basic authentication popup in Selenium WebDriver are as below:-

  1. Add Multipass extension to chrome browser.
  2. Open extension webpage.
  3. Locate URL, Username and Password fields and pass values and click on Add button.
  4. You are done.

These steps will be more clear in a video tutorial which you can find below:-

Chrome extension download link –

Grab the source code with extension –

This post is contributed by :-

Koushik Chatterjee who is a QA Engineer and Chrome extension developer (Ruto – XPath Finder) and YouTuber @ Connect with him on LinkedIn @

You can download/clone above sample project from here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.

Find all Selenium related post here, all API manual and automation related posts here and find frequently asked Java Programs here.

Many other topics you can navigate through menu.

Table of Contents

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.

Handling Window Authentication in Chrome Using Selenium WebDriver

by Amod Mahajan time to read: 2 min
%d bloggers like this: