1 回答

TA贡献1789条经验 获得超8个赞
问题已经解决了。我必须使用 FirefoxProfile 来覆盖所有浏览器配置值。
请检查此以获取更多详细信息。
public RemoteWebDriver getWebDriverObject(DesiredCapabilities capabilities) {
String os = SystemUtils.IS_OS_WINDOWS ? "windows" : "linux";
System.setProperty("webdriver.gecko.driver", "target/test-classes/selenium_standalone_binaries/" + os + "/marionette/64bit/geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.merge(capabilities);
options.setHeadless(HEADLESS);
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.automatic-ntlm-auth.trusted-uris", "http://localhost:8080");
profile.setPreference("dom.disable_beforeunload", false);
options.setProfile(profile);
options.setLogLevel(FirefoxDriverLogLevel.DEBUG);
return new FirefoxDriver(options);
}
添加回答
举报