示例#1
0
        private static ICapabilities ConvertOptionsToCapabilities(ChromiumOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options", "options must not be null");
            }

            return(options.ToCapabilities());
        }
示例#2
0
 /// <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");
 }
示例#3
0
 /// <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)
 {
 }
示例#4
0
 /// <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;
 }