/// <summary> /// Initializes a new instance of the <see cref="FirefoxDriver"/> class using the specified driver service. Uses the Mozilla-provided Marionette driver implementation. /// </summary> /// <param name="service">The <see cref="FirefoxDriverService"/> used to initialize the driver.</param> public FirefoxDriver(FirefoxDriverService service) : this(service, new FirefoxOptions(), RemoteWebDriver.DefaultCommandTimeout) { }
/// <summary> /// Initializes a new instance of the <see cref="FirefoxDriver"/> class using the specified options, driver service, and timeout. Uses the Mozilla-provided Marionette driver implementation. /// </summary> /// <param name="service">The <see cref="FirefoxDriverService"/> to use.</param> /// <param name="options">The <see cref="FirefoxOptions"/> to be used with the Firefox driver.</param> /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param> public FirefoxDriver(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout) : base(new DriverServiceCommandExecutor(service, commandTimeout), ConvertOptionsToCapabilities(options)) { }
private static ICommandExecutor CreateExecutor(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout) { ICommandExecutor executor = null; if (options.UseLegacyImplementation) { // Note: If BrowserExecutableLocation is null or empty, the legacy driver // will still do the right thing, and find Firefox in the default location. FirefoxBinary binary = new FirefoxBinary(options.BrowserExecutableLocation); FirefoxProfile profile = options.Profile; if (profile == null) { profile = new FirefoxProfile(); } executor = CreateExtensionConnection(binary, profile, commandTimeout); } else { if (service == null) { throw new ArgumentNullException("service", "You requested a service-based implementation, but passed in a null service object."); } return new DriverServiceCommandExecutor(service, commandTimeout); } return executor; }