0

Is there any way to block authentication dialogs?

I tried the AdBlockPlus addon. This does not seem to prevent Authorization required. I'm using selenium for browser automatisation. When there comes a authentication popup the whole programm waits until the popup is closed. So I want that firefox handles authentication popus like if I always click on cancel.

  • What should happen once you have prevented the user from authenticating? – roaima Feb 24 '15 at 22:11
  • Please give us more details. – komaflash Feb 24 '15 at 22:13
  • It shall happen like if I click on cancel in the authenticating dialog. – John Smithv1 Feb 24 '15 at 22:14
0

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 {

profile.addExtension(extension);

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}
WebDriver driver = new FirefoxDriver(profile);

driver.get("http://demo.tanmaysarkar.com/authentication/");

driver.get("http://demo.tanmaysarkar.com/authentication/");
try {

Thread.sleep(10000);

} catch (InterruptedException ex) {

Thread.currentThread().interrupt();

}
driver.quit();
}
}

You have to modify the firefox addon https://addons.mozilla.org/en-us/firefox/addon/autoauth/. In there is the file chrome/content/overlay.js Replace the overlay.js with my version on http://pastebin.com/XRVxJdey

I hope this helps somebody

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.