Authentication dialog with selenium and Firefox profile

Previously I published a post to handle Authentication dialog with autoit.But today we handle this dialog without autoit. For this purpose we need to create a new firefox profile. If you don’t know how to create new firefox profile , you can see this article.
We need autoauth addon to store authentication password to our local.

Now open new profile and add this addon and also save it to your local.
It will required for our test script.
And open that particular site which asked for authentication.
[Example – id-“tanmay” pw-“sarkar”]

Enter id and password and you will see “password save” message is coming.
Now authentication credentials are saved into your local on that profile.

Now everything is ready , just run the following code to automate your test.

package com.tanmaysarkar.demo;


import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;

public class Check {

	public WebDriver driver;
	private String baseUrl;
	public static void main(String[] args) {
		Check c = new Check();
	public void launch_browser(){
		 FirefoxProfile firefoxProfile = new ProfilesIni().getProfile("Test User");
		 File pluginAutoAuth = new File("e:\\auto-auth.xpi");
		 driver = new FirefoxDriver(firefoxProfile);
		 baseUrl = "";
		 System.out.println("Opening " + baseUrl);
		 System.out.println("Without Authentication i am running");
		catch (Exception ex)


Note :- “Test User” is my new Firefox profile name.

Related posts:

Leave a Reply

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