Tabnine Logo
FirefoxOptions
Code IndexAdd Tabnine to your IDE (free)

How to use
FirefoxOptions
in
org.openqa.selenium.firefox

Best Java code snippets using org.openqa.selenium.firefox.FirefoxOptions (Showing top 20 results out of 369)

origin: stackoverflow.com

var driver = new FirefoxDriver(new FirefoxOptions());
origin: spring-io/initializr

@BeforeEach
public void setup(@TempDirectory.TempDir Path folder) throws IOException {
  Assumptions.assumeTrue(Boolean.getBoolean("smoke.test"),
      "Smoke tests disabled (set System property 'smoke.test')");
  this.downloadDir = folder.toFile();
  FirefoxProfile fxProfile = new FirefoxProfile();
  fxProfile.setPreference("browser.download.folderList", 2);
  fxProfile.setPreference("browser.download.manager.showWhenStarting", false);
  fxProfile.setPreference("browser.download.dir",
      this.downloadDir.getAbsolutePath());
  fxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
      "application/zip,application/x-compress,application/octet-stream");
  FirefoxOptions options = new FirefoxOptions().setProfile(fxProfile);
  this.driver = new FirefoxDriver(options);
  ((JavascriptExecutor) this.driver).executeScript("window.focus();");
  Actions actions = new Actions(this.driver);
  this.enterAction = actions.sendKeys(Keys.ENTER).build();
}
origin: selenide/selenide

private Capabilities getHeadlessCapabilities(Config config, Browser browser) {
 log.info("Starting in headless mode");
 if (browser.isChrome()) {
  ChromeOptions options = new ChromeOptions();
  options.setHeadless(config.headless());
  return options;
 } else if (browser.isFirefox()) {
  FirefoxOptions options = new FirefoxOptions();
  options.setHeadless(config.headless());
  return options;
 } else {
  log.warning("Headless mode on remote server is only supported for Chrome/Firefox, setting will be ignored.");
 }
 return new DesiredCapabilities();
}
origin: selenide/selenide

FirefoxOptions createFirefoxOptions(Config config, Proxy proxy) {
 FirefoxOptions firefoxOptions = new FirefoxOptions();
 firefoxOptions.setHeadless(config.headless());
 if (!config.browserBinary().isEmpty()) {
  log.info("Using browser binary: " + config.browserBinary());
  firefoxOptions.setBinary(config.browserBinary());
 }
 firefoxOptions.addPreference("network.automatic-ntlm-auth.trusted-uris", "http://,https://");
 firefoxOptions.addPreference("network.automatic-ntlm-auth.allow-non-fqdn", true);
 firefoxOptions.addPreference("network.negotiate-auth.delegation-uris", "http://,https://");
 firefoxOptions.addPreference("network.negotiate-auth.trusted-uris", "http://,https://");
 firefoxOptions.addPreference("network.http.phishy-userpass-length", 255);
 firefoxOptions.addPreference("security.csp.enable", false);
 firefoxOptions.addPreference("network.proxy.no_proxies_on", "");
 firefoxOptions.merge(createCommonCapabilities(config, proxy));
 firefoxOptions = transferFirefoxProfileFromSystemProperties(firefoxOptions);
 return firefoxOptions;
}
origin: selenide/selenide

 private FirefoxOptions transferFirefoxProfileFromSystemProperties(FirefoxOptions currentFirefoxOptions) {
  String prefix = "firefoxprofile.";
  FirefoxProfile profile = Optional.ofNullable(currentFirefoxOptions.getProfile())
   .orElseGet(FirefoxProfile::new);
  for (String key : System.getProperties().stringPropertyNames()) {
   if (key.startsWith(prefix)) {
    String capability = key.substring(prefix.length());
    String value = System.getProperties().getProperty(key);
    log.config("Use " + key + "=" + value);
    if (value.equals("true") || value.equals("false")) {
     profile.setPreference(capability, Boolean.valueOf(value));
    }
    else if (value.matches("^-?\\d+$")) { //if integer
     profile.setPreference(capability, Integer.parseInt(value));
    }
    else {
     profile.setPreference(capability, value);
    }
   }
  }
  return currentFirefoxOptions.setProfile(profile);
 }
}
origin: org.mycore/selenium-utils

@Override
public WebDriver getDriver() {
  FirefoxProfile profile = getFirefoxProfile(Locale.GERMANY);
  FirefoxOptions firefoxOptions = new FirefoxOptions();
  firefoxOptions.setProfile(profile);
  LogManager.getLogger().info("is headless: {}", isHeadless());
  firefoxOptions.setHeadless(isHeadless());
  FirefoxDriver firefoxDriver = new FirefoxDriver(firefoxOptions);
  firefoxDriver.manage().window().setSize(new Dimension(dimX, dimY));
  firefoxDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  return firefoxDriver;
}
origin: mozilla/zest

FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setHeadless(isHeadless());
if (isProfilePathSet()) {
  firefoxOptions.setProfile(new FirefoxProfile(new File(profilePath)));
  firefoxOptions.addPreference("network.proxy.type", 1);
  firefoxOptions.addPreference("network.proxy.http", proxyAddress);
  firefoxOptions.addPreference("network.proxy.http_port", proxyPort);
  firefoxOptions.addPreference("network.proxy.ssl", proxyAddress);
  firefoxOptions.addPreference("network.proxy.ssl_port", proxyPort);
  firefoxOptions.addPreference("network.proxy.share_proxy_settings", true);
  firefoxOptions.addPreference("network.proxy.no_proxies_on", "");
firefoxOptions.merge(cap);
origin: Frameworkium/frameworkium-core

  @Override
  public WebDriver getWebDriver(Capabilities capabilities) {
    final FirefoxOptions firefoxOptions;
    if (capabilities instanceof FirefoxOptions) {
      firefoxOptions = (FirefoxOptions) capabilities;
    } else {
      firefoxOptions = new FirefoxOptions().merge(capabilities);
    }
    return new FirefoxDriver(firefoxOptions);
  }
}
origin: Frameworkium/frameworkium-core

@Override
public FirefoxOptions getCapabilities() {
  FirefoxOptions firefoxOptions = new FirefoxOptions();
  firefoxOptions.setHeadless(Property.HEADLESS.getBoolean());
  firefoxOptions.setLogLevel(FirefoxDriverLogLevel.INFO);
  return firefoxOptions;
}
origin: selenide/selenide

Capabilities getBrowserBinaryCapabilities(Config config, Browser browser) {
 log.info("Using browser binary: " + config.browserBinary());
 if (browser.isChrome()) {
  ChromeOptions options = new ChromeOptions();
  options.setBinary(config.browserBinary());
  return options;
 } else if (browser.isFirefox()) {
  FirefoxOptions options = new FirefoxOptions();
  options.setBinary(config.browserBinary());
  return options;
 } else {
  log.warning("Changing browser binary on remote server is only supported for Chrome/Firefox, setting will be ignored.");
 }
 return new DesiredCapabilities();
}
origin: de.otto/jlineup-core

if (jobConfig.browser.isFirefox()) {
  WebDriverManager.firefoxdriver().setup();
  FirefoxOptions options = new FirefoxOptions();
  options.setProfile(getFirefoxProfileWithDisabledAnimatedGifs());
  options.addArguments(runStepConfig.getFirefoxParameters());
  if (jobConfig.browser.isHeadless()) {
    options.setHeadless(true);
    options.addArguments("-width", width + "", "-height", jobConfig.windowHeight + "");
  LOG.debug("Creating firefox with options: {}", options.toString());
  driver = new FirefoxDriver(options);
} else if (jobConfig.browser.isChrome()) {
origin: org.bitbucket.iamkenos/cissnei-selenium

@Override
public void setDriverOptions() {
  Proxy proxy = new Proxy();
  options = new FirefoxOptions();
  options.setHeadless(drHeadless);
    options.setCapability(PROXY, proxy);
  options.setCapability(ACCEPT_SSL_CERTS, drAcceptSsl);
  options.setCapability(SUPPORTS_APPLICATION_CACHE, drSupportCache);
  options.setCapability(SUPPORTS_ALERTS, drAlertsHandled);
      options.setUnhandledPromptBehaviour(ACCEPT);
      break;
    case DISMISS:
      options.setUnhandledPromptBehaviour(DISMISS);
      break;
    case IGNORE:
      options.setUnhandledPromptBehaviour(IGNORE);
      break;
    default:
      options.setUnhandledPromptBehaviour(DISMISS);
      break;
    options.addArguments(format("user-data-dir=%s", drCustomProfileDir));
  options.setAcceptInsecureCerts(drAllowInsecureContent);
  options.addPreference("download.prompt_for_download", drPromptForDl);
  options.addPreference("download.default_directory", driverDlPath);
origin: org.kurento/kurento-test

 WebDriverManager.firefoxdriver().setup();
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.addPreference("media.navigator.permission.disabled", true);
firefoxOptions.addPreference("media.navigator.streams.fake", true);
firefoxOptions.setAcceptInsecureCerts(true);
capabilities.setBrowserName(firefoxOptions.getBrowserName());
    File xpi = File.createTempFile(extension.keySet().iterator().next(), ".xpi");
    FileUtils.copyInputStreamToFile(is, xpi);
    firefoxOptions.getProfile().addExtension(xpi);
   } catch (Throwable t) {
    log.error("Error loading Firefox extension {} ({} : {})", extension, t.getClass(),
origin: bonigarcia/selenium-jupiter

  Optional<Object> testInstance)
  throws IOException, IllegalAccessException {
FirefoxOptions firefoxOptions = new FirefoxOptions();
      FirefoxProfile firefoxProfile = new FirefoxProfile();
      firefoxProfile.addExtension(getExtension(extension));
      firefoxOptions.setProfile(firefoxProfile);
    firefoxOptions.setBinary(binary.value());
  if (optionsFromAnnotatedField != null) {
    firefoxOptions = optionsFromAnnotatedField
        .merge(firefoxOptions);
origin: alfa-laboratory/akita

/**
 * Задает options для запуска Firefox драйвера
 * options можно передавать, как системную переменную, например -Doptions=--load-extension=my-custom-extension
 * @return FirefoxOptions
 */
private FirefoxOptions getFirefoxDriverOptions(DesiredCapabilities capabilities) {
  log.info("---------------Firefox Driver---------------------");
  FirefoxOptions firefoxOptions = !options[0].equals("") ? new FirefoxOptions().addArguments(options) : new FirefoxOptions();
  capabilities.setVersion(loadSystemPropertyOrDefault(CapabilityType.BROWSER_VERSION, VERSION_LATEST));
  firefoxOptions.setHeadless(getHeadless());
  firefoxOptions.merge(capabilities);
  return firefoxOptions;
}
origin: com.github.bordertech.webfriends/webfriends-selenium

@Override
public FirefoxOptions getDefaultOptions() {
  FirefoxOptions opt = new FirefoxOptions();
  opt.addPreference("browser.startup.homepage", "about:blank");
  opt.addPreference("startup.homepage_welcome_url", "about:blank");
  opt.addPreference("startup.homepage_welcome_url.additional", "about:blank");
  return opt;
}
origin: com.vaadin/vaadin-testbench-core

String profilePath = System.getProperty("firefox.profile.path");
FirefoxOptions options = new FirefoxOptions();
if (firefoxPath != null) {
  options.setBinary(new FirefoxBinary(new File(firefoxPath)));
  File profileDir = new File(profilePath);
  FirefoxProfile profile = new FirefoxProfile(profileDir);
  options.setProfile(profile);
origin: webrtc/KITE

FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(firefoxProfile);
if (browser.isHeadless()) {
 firefoxOptions.addArguments("-headless");
 firefoxOptions.addArguments(flag);
origin: net.jangaroo/jangaroo-maven-plugin

private WebDriver createWebDriver(DriverManagerType driverManagerType) throws IllegalArgumentException, WebDriverManagerException {
 switch (driverManagerType) {
  case CHROME:
   ChromeOptions chromeOptions = new ChromeOptions();
   chromeOptions.setHeadless(true);
   chromeOptions.addArguments(jooUnitWebDriverBrowserArguments);
   getLog().info("Starting Chrome with " + jooUnitWebDriverBrowserArguments.size() + " arguments: " + String.join(" ", jooUnitWebDriverBrowserArguments));
   return new ChromeDriver(chromeOptions);
  case FIREFOX:
   FirefoxOptions firefoxOptions = new FirefoxOptions();
   firefoxOptions.setHeadless(true);
   firefoxOptions.addArguments(jooUnitWebDriverBrowserArguments);
   getLog().info("Starting Firefox with " + jooUnitWebDriverBrowserArguments.size() + " arguments: " + String.join(" ", jooUnitWebDriverBrowserArguments));
   return new FirefoxDriver(firefoxOptions);
  case EDGE:
   return new EdgeDriver(); // no headless mode and no arguments yet :-(
  case IEXPLORER:
   return new InternetExplorerDriver(); // no headless mode and no arguments yet :-(
  case OPERA:
   return new OperaDriver(); // no headless mode and no arguments yet :-(
 }
 throw new IllegalArgumentException();
}
origin: io.wcm.qa/io.wcm.qa.galenium.galenium

@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;
}
org.openqa.selenium.firefoxFirefoxOptions

Javadoc

Manage firefox specific settings in a way that geckodriver can understand.

An example of usage:

 
FirefoxOptions options = new FirefoxOptions() 
.addPreference("browser.startup.page", 1) 
.addPreference("browser.startup.homepage", "https://www.google.co.uk"); 
WebDriver driver = new FirefoxDriver(options); 

Most used methods

  • <init>
  • setProfile
  • setHeadless
  • merge
  • addArguments
  • setBinary
  • addPreference
  • setCapability
  • setLogLevel
  • setAcceptInsecureCerts
  • getProfile
  • setLegacy
  • getProfile,
  • setLegacy,
  • setProxy,
  • SetLoggingPreference,
  • getBinary,
  • getBinaryOrNull,
  • getBrowserName,
  • isLegacy,
  • setUnhandledPromptBehaviour,
  • toString

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • getApplicationContext (Context)
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ImageIO (javax.imageio)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now