How to handle chrome Http Authentication popup window using selenium.

We are familiar to handle http authentication using url sub resources that contain embedded credentials like below

https://{USERNAME}:{PASSWORD}@xyz.com

Above solution are valid for below browser version:

But above embedded credentials feature are removed from above version and grater version.

 In our selenium automation framework if we use above approach to handle http authentication then we face issue, it will not work.

We explored to handle http authentication on latest version of browser and came up that we can handle using chrome multipass browser add-ons and using chrome profile

Installation of chrome add-ons:

Open chrome default browser and install below add-ons

After installation you should see screen at right top corner like on below screen.

Setup user name and password:

Click on icon and enter url, user name and password.

It will save details in browser and when you run your test on same browser profile, it will automatically handle and authentication popup will not display.

Setup Profile in automation framework:

I am taking example how of protractor framework how we call same profile in our test so it will executed test scripts on same browser profile and authentication popup will automatically handle.

Open config.js file of protractor framework and add update profile path like below:

capabilities: {

        ‘browserName’: ‘chrome’,

        chromeOptions: {

            args: [“user-data-dir=C:\\Users\\{UserName}\\AppData\\Local\\Google\\Chrome\\User Data\\Default”],           

        },

    },

Now run your test scripts, you should see same profile will open and added add-on will visible at top right corner and authentication pop-up automatically handled.

You can implement this approach in other selenium automation framework like java, C# python etc.

Author : Sadik Ali

SHARE THIS

Get A Free Quote

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.