public FirefoxOptions setBinary(Path path) { setCapability(BINARY, path); return this; }
public FirefoxOptions setProfile(FirefoxProfile profile) { setCapability(FirefoxDriver.PROFILE, profile); return this; }
public FirefoxOptions setLegacy(boolean legacy) { setCapability(MARIONETTE, !legacy); return this; }
public FirefoxOptions setAcceptInsecureCerts(boolean acceptInsecureCerts) { setCapability(ACCEPT_INSECURE_CERTS, acceptInsecureCerts); return this; }
public FirefoxOptions setBinary(FirefoxBinary binary) { setCapability(BINARY, binary); return this; }
public FirefoxOptions setBinary(String path) { setCapability(BINARY, path); return this; }
public FirefoxOptions setProxy(Proxy proxy) { setCapability(CapabilityType.PROXY, proxy); return this; }
public FirefoxOptions setPageLoadStrategy(PageLoadStrategy strategy) { setCapability( PAGE_LOAD_STRATEGY, Objects.requireNonNull(strategy, "Page load strategy must be set")); return this; }
public FirefoxOptions setUnhandledPromptBehaviour(UnexpectedAlertBehaviour behaviour) { setCapability( UNHANDLED_PROMPT_BEHAVIOUR, Objects.requireNonNull(behaviour, "Unhandled prompt behavior must be set")); return this; }
@Override protected FirefoxOptions getBrowserSpecificOptions() { getLogger().debug("creating capabilities for Firefox"); FirefoxOptions options = new FirefoxOptions(); FirefoxProfile firefoxProfile = new FirefoxProfile(); firefoxProfile.setAcceptUntrustedCertificates(true); firefoxProfile.setAssumeUntrustedCertificateIssuer(false); options.setCapability(FirefoxDriver.PROFILE, firefoxProfile); return options; }
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); }
source.asMap().forEach((key, value)-> { if (value != null) { setCapability(key, value); if (that.binary != null) { setCapability(BINARY, that.binary.asCapability()); }
@Override protected MutableCapabilities getDriverOptions() { FirefoxOptions options = new FirefoxOptions(); if (webDriverConfig.isHeadlessBrowser()) { logger.info("setting firefox in headless mode. Supported for firefox version >= 56"); options.addArguments("-headless"); options.addArguments("--window-size=1280,1024"); options.addArguments("--width=1280"); options.addArguments("--height=1024"); } FirefoxProfile profile = getFirefoxProfile(webDriverConfig); configProfile(profile, webDriverConfig); options.setCapability(FirefoxDriver.PROFILE, profile); options.setLogLevel(FirefoxDriverLogLevel.ERROR); if (webDriverConfig.isDevMode()) { options.setLogLevel(FirefoxDriverLogLevel.TRACE); } // handle https://bugzilla.mozilla.org/show_bug.cgi?id=1429338#c4 and https://github.com/mozilla/geckodriver/issues/789 options.setCapability("moz:useNonSpecCompliantPointerOrigin", true); return options; }
private static CommandExecutor toExecutor(FirefoxOptions options) { Objects.requireNonNull(options, "No options to construct executor from"); DriverService.Builder<?, ?> builder; if (! Boolean.parseBoolean(System.getProperty(SystemProperty.DRIVER_USE_MARIONETTE, "true")) || options.isLegacy()) { FirefoxProfile profile = options.getProfile(); if (profile == null) { profile = new FirefoxProfile(); options.setCapability(FirefoxDriver.PROFILE, profile); } builder = XpiDriverService.builder() .withBinary(options.getBinary()) .withProfile(profile); } else { builder = new GeckoDriverService.Builder() .usingFirefoxBinary(options.getBinary()); } return new FirefoxDriverCommandExecutor(builder.build()); }
options.setCapability(PROXY, proxy); options.setCapability(ACCEPT_SSL_CERTS, drAcceptSsl); options.setCapability(SUPPORTS_APPLICATION_CACHE, drSupportCache); options.setCapability(SUPPORTS_ALERTS, drAlertsHandled); options.addPreference("download.default_directory", driverDlPath); options.addPreference("profile.default_content_settings.popups", 0); options.setCapability(CapabilityType.LOGGING_PREFS, getLoggingPrefs());
@Override protected FirefoxDriver createBrowser() { FirefoxOptions desiredCapabilities = new FirefoxOptions(createCapabilities()); desiredCapabilities.setCapability(FirefoxDriver.PROFILE, createProfile()); return new FirefoxDriver(new GeckoDriverService.Builder().usingFirefoxBinary(new FirefoxBinary()).build(), desiredCapabilities); }