RE: Handle HTTP Authentication – Authentication required dialog

I’m using Selenium with the Firefox Webdriver to test different events on my Website.

One event leads to a HTTP authentication dialog.
Is there a way to set selenium to always press cancel or to reach a timeout so I don’t hang around and get back the control of the driver?

johnsmithv2 Default Asked on February 25, 2015 in Selenium WebDriver.
Add Comment
4 Answers

I found my own solution for the problem. I’m using a modified version of the Firefox add-on AutoAuth. Normally this clicks the OK button when you visited a HTTP Authentication dialog before and saved username and password. I modified the plugin so that it always cancels the dialog.
It’s working very well on Firefox 35.

My Java Code:

public class Main {
public static void main(String[] args) {
// create profile

FirefoxProfile profile = new FirefoxProfile();
//add a extension to firefox

File extension = new File("autoauth-2.1-fx+fn.xpi");

try {


} catch (IOException e) {

// TODO Auto-generated catch block


WebDriver driver = new FirefoxDriver(profile);


try {


} catch (InterruptedException ex) {



You have to modify the firefox addon In there is the file chrome/content/overlay.js
Replace the overlay.js with my version on

I hope this helps somebody!

Default Answered on February 26, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.