Skip to content

Commit d11bd0c

Browse files
committed
Allowed localhost to authenticate with NTLM in Firefox
1 parent 0b076dd commit d11bd0c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/com/octopus/decorators/FirefoxDecorator.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import org.openqa.selenium.WebDriver;
66
import org.openqa.selenium.firefox.FirefoxDriver;
77
import org.openqa.selenium.firefox.FirefoxOptions;
8+
import org.openqa.selenium.firefox.FirefoxProfile;
9+
import org.openqa.selenium.firefox.ProfilesIni;
810

911
public class FirefoxDecorator extends AutomatedBrowserBase {
1012

@@ -22,8 +24,16 @@ public FirefoxDecorator(final boolean headless, final AutomatedBrowser automated
2224

2325
@Override
2426
public void init() {
27+
final ProfilesIni profile = new ProfilesIni();
28+
final FirefoxProfile myprofile = profile.getProfile("default");
29+
myprofile.setPreference("network.automatic-ntlm-auth.trusted-uris", "localhost");
30+
myprofile.setPreference("network.negotiate-auth.delegation-uris", "localhost");
31+
myprofile.setPreference("network.negotiate-auth.trusted-uris", "localhost");
32+
myprofile.setPreference("network.automatic-ntlm-auth.allow-non-fqdn", "true");
33+
2534
final FirefoxOptions options = new FirefoxOptions();
2635
options.setHeadless(headless);
36+
options.setProfile(myprofile);
2737
options.merge(getDesiredCapabilities());
2838
final WebDriver webDriver = new FirefoxDriver(options);
2939
getAutomatedBrowser().setWebDriver(webDriver);

0 commit comments

Comments
 (0)