private static ICapabilities ConvertOptionsToCapabilities(ChromiumOptions options) { if (options == null) { throw new ArgumentNullException("options", "options must not be null"); } return(options.ToCapabilities()); }
/// <summary> /// Initializes a new instance of the <see cref="ChromiumDriver"/> class using the specified <see cref="ChromiumDriverService"/>. /// </summary> /// <param name="service">The <see cref="ChromiumDriverService"/> to use.</param> /// <param name="options">The <see cref="ChromiumOptions"/> to be used with the Chrome driver.</param> /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param> public ChromiumDriver(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout) : base(new DriverServiceCommandExecutor(service, commandTimeout), ConvertOptionsToCapabilities(options)) { // Add the custom commands unique to Chrome this.AddCustomChromeCommand(GetNetworkConditionsCommand, CommandInfo.GetCommand, "/session/{sessionId}/chromium/network_conditions"); this.AddCustomChromeCommand(SetNetworkConditionsCommand, CommandInfo.PostCommand, "/session/{sessionId}/chromium/network_conditions"); this.AddCustomChromeCommand(DeleteNetworkConditionsCommand, CommandInfo.DeleteCommand, "/session/{sessionId}/chromium/network_conditions"); this.AddCustomChromeCommand(SendChromeCommand, CommandInfo.PostCommand, "/session/{sessionId}/chromium/send_command"); this.AddCustomChromeCommand(SendChromeCommandWithResult, CommandInfo.PostCommand, "/session/{sessionId}/chromium/send_command_and_get_result"); }
/// <summary> /// Initializes a new instance of the <see cref="ChromiumDriver"/> class using the specified /// <see cref="ChromiumDriverService"/> and options. /// </summary> /// <param name="service">The <see cref="ChromiumDriverService"/> to use.</param> /// <param name="options">The <see cref="ChromiumOptions"/> used to initialize the driver.</param> public ChromiumDriver(ChromiumDriverService service, ChromiumOptions options) : this(service, options, RemoteWebDriver.DefaultCommandTimeout) { }
/// <summary> /// Initializes a new instance of the <see cref="ChromiumDriver"/> class using the specified <see cref="ChromiumDriverService"/>. /// </summary> /// <param name="service">The <see cref="ChromiumDriverService"/> to use.</param> /// <param name="options">The <see cref="ChromiumOptions"/> to be used with the ChromiumDriver.</param> /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param> protected ChromiumDriver(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout) : base(new DriverServiceCommandExecutor(service, commandTimeout), ConvertOptionsToCapabilities(options)) { this.optionsCapabilityName = options.CapabilityName; }