I have had the problem for 2 weeks that when I create a new Firefox driver in Selenium, the authentication popup for the proxy is immediately pushed into the background. Selenium can't reach it there anymore. Do you have a solution to the problem? I am using Selenium 3.141.5, Java 1.8. and Firefox version 63.0.1.
System.setProperty("webdriver.gecko.driver", "C:\\Program Files\\geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Program Files\\Mozilla Firefox\\firefox.exe");
WebDriver driver = new FirefoxDriver(options);
try {
Alert alert = driver.switchTo().alert();
alert.sendKeys("Username" + Keys.TAB + "Password");
alert.accept();
driver.switchTo().defaultContent();
}catch (NoAlertPresentException e) {
e.printStackTrace();
}
driver.get("https://www.google.de/");
EDIT: I tested it with Firefox version 62.0.3, everything works there.
Best way is to avoid the pop-up.
use the customized profile, there is my setup:
FirefoxOptions options = new FirefoxOptions();
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile selenium_profile = allProfiles.getProfile("selenium_profile");
options.setProfile(selenium_profile);
options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
System.setProperty("webdriver.gecko.driver", sec_var.driver_path);
driver = new FirefoxDriver(options);
driver.manage().window().maximize();
With custom browser profile you can use almost any settings modification, imported certificate (to avoid another auth pop-up), use extensions, ...
Basic auth pop-up you can avoid with send credentials in URL:
driver.get("https://username:password@www.example.com");
but it does not work in Chrome.