Class FirefoxOptions

java.lang.Object
org.openqa.selenium.MutableCapabilities
org.openqa.selenium.remote.AbstractDriverOptions<FirefoxOptions>
org.openqa.selenium.firefox.FirefoxOptions
All Implemented Interfaces:
Serializable, org.openqa.selenium.Capabilities

public class FirefoxOptions extends org.openqa.selenium.remote.AbstractDriverOptions<FirefoxOptions>
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);
 
See Also:
  • Field Details

  • Constructor Details

    • FirefoxOptions

      public FirefoxOptions()
    • FirefoxOptions

      public FirefoxOptions(org.openqa.selenium.Capabilities source)
  • Method Details

    • configureFromEnv

      public FirefoxOptions configureFromEnv()
      Configures the following:
      Binary
      webdriver.firefox.bin - the path to the firefox binary
      Firefox profile
      webdriver.firefox.profile - a named firefox profile
    • getBinary

      @Deprecated public FirefoxBinary getBinary()
      Deprecated.
      This method is deprecated and will be removed in a future version. Selenium Manager handles this for you.
      Constructs a FirefoxBinary and returns that to be used, and because of this is only useful when actually starting firefox.
    • setBinary

      @Deprecated public FirefoxOptions setBinary(FirefoxBinary binary)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use setBinary(Path) or setBinary(String) instead.
      Sets the path to the Firefox binary to use. This is useful when you have multiple versions of Firefox installed on your machine.
    • setBinary

      public FirefoxOptions setBinary(Path path)
    • setBinary

      public FirefoxOptions setBinary(String path)
    • getBinaryOrNull

      @Deprecated public Optional<FirefoxBinary> getBinaryOrNull()
      Deprecated.
      This method is deprecated and will be removed in a future version. Selenium Manager handles this for you.}
      Returns the binary as a FirefoxBinary if it was set, or an empty Optional if not.
    • getProfile

      public FirefoxProfile getProfile()
    • setProfile

      public FirefoxOptions setProfile(FirefoxProfile profile)
    • addArguments

      public FirefoxOptions addArguments(String... arguments)
    • addArguments

      public FirefoxOptions addArguments(List<String> arguments)
    • addPreference

      public FirefoxOptions addPreference(String key, Object value)
    • setLogLevel

      public FirefoxOptions setLogLevel(FirefoxDriverLogLevel logLevel)
    • setAndroidPackage

      public FirefoxOptions setAndroidPackage(String androidPackage)
    • setAndroidActivity

      public FirefoxOptions setAndroidActivity(String activity)
    • setAndroidDeviceSerialNumber

      public FirefoxOptions setAndroidDeviceSerialNumber(String serial)
    • setAndroidIntentArguments

      public FirefoxOptions setAndroidIntentArguments(String[] args)
    • setAndroidIntentArguments

      public FirefoxOptions setAndroidIntentArguments(List<String> args)
    • enableBiDi

      public FirefoxOptions enableBiDi()
    • getExtraCapabilityNames

      protected Set<String> getExtraCapabilityNames()
      Specified by:
      getExtraCapabilityNames in class org.openqa.selenium.remote.AbstractDriverOptions<FirefoxOptions>
    • getExtraCapability

      protected Object getExtraCapability(String capabilityName)
      Specified by:
      getExtraCapability in class org.openqa.selenium.remote.AbstractDriverOptions<FirefoxOptions>
    • merge

      public FirefoxOptions merge(org.openqa.selenium.Capabilities capabilities)
      Specified by:
      merge in interface org.openqa.selenium.Capabilities
      Overrides:
      merge in class org.openqa.selenium.MutableCapabilities