Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Handling Window Authentication in Chrome Using Selenium WebDriver

Posted on 03/21/2025 By admin

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 – https://github.com/SeleniumHQ/selenium/blob/selenium-3.4.0/java/client/src/org/openqa/selenium/Alert.java

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 –

https://chrome.google.com/webstore/detail/multipass-for-http-basic/enhldmjbphoeibbpdhmjkchohnidgnah

Grab the source code with extension –

https://github.com/ortoniKC/letCode/tree/master/auth

This post is contributed by :-

Koushik Chatterjee who is a QA Engineer and Chrome extension developer (Ruto – XPath Finder) and YouTuber @ https://youtube.com/letcode. Connect with him on LinkedIn @ https://www.linkedin.com/in/ortoni

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

#HappyLearning

Uncategorized

Post navigation

Previous Post: TestNG Tutorials 9: Internal Logic Of Generation Of TestNG.xml
Next Post: Postman Tutorial Part 13 – Create, Manage and Use Environment In Postman

Related Posts

July 15, 2018 – Make Selenium Easy Uncategorized
API Testing Tutorial Part 10 – Introduction of SOAP (Simple Object Access Protocol) | Make Selenium Easy Uncategorized
September 5, 2018 – Make Selenium Easy Uncategorized
cropped-cssInConsole.png Uncategorized
April 22, 2017 – Make Selenium Easy Uncategorized
Java For Selenium Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark