- Common ways to obtain FirefoxOptions
private void myMethod () {FirefoxOptions f =
new FirefoxOptions()
Capabilities source;new FirefoxOptions(source)
Capabilities capabilities;new FirefoxOptions().merge(capabilities)
- Smart code suggestions by Codota
}
public FirefoxOptions() { // Read system properties and use those if they are set, allowing users to override them later // should they want to. String binary = System.getProperty(FirefoxDriver.SystemProperty.BROWSER_BINARY); if (binary != null) { setBinary(binary); } String profileName = System.getProperty(FirefoxDriver.SystemProperty.BROWSER_PROFILE); if (profileName != null) { FirefoxProfile profile = new ProfilesIni().getProfile(profileName); if (profile == null) { throw new WebDriverException(String.format( "Firefox profile '%s' named in system property '%s' not found", profileName, FirefoxDriver.SystemProperty.BROWSER_PROFILE)); } setProfile(profile); } String forceMarionette = System.getProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE); if (forceMarionette != null) { setLegacy(!Boolean.getBoolean(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE)); } setCapability(CapabilityType.BROWSER_NAME, BrowserType.FIREFOX); setAcceptInsecureCerts(true); }
firefoxOptions.setAcceptInsecureCerts(true);
firefoxOptions.setAcceptInsecureCerts(true);
public void using(EnvironmentVariables environmentVariables) { options.setHeadless(HEADLESS_MODE.booleanFrom(environmentVariables,false)); options.setAcceptInsecureCerts(ACCEPT_INSECURE_CERTIFICATES.booleanFrom(environmentVariables,false)); FirefoxDriverLogLevel logLevel = FirefoxDriverLogLevel.fromString(FIREFOX_LOG_LEVEL.from(environmentVariables,"ERROR")); options.setLogLevel(logLevel); } }
options.addArguments(format("user-data-dir=%s", drCustomProfileDir)); options.setAcceptInsecureCerts(drAllowInsecureContent); options.addPreference("download.prompt_for_download", drPromptForDl); options.addPreference("download.default_directory", driverDlPath);