@@ -40,7 +40,7 @@ public EdgeDriver()
40
40
/// </summary>
41
41
/// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>
42
42
public EdgeDriver ( EdgeOptions options )
43
- : this ( EdgeDriverService . CreateDefaultService ( ) , options )
43
+ : this ( EdgeDriverService . CreateDefaultServiceFromOptions ( options ) , options )
44
44
{
45
45
}
46
46
@@ -49,25 +49,25 @@ public EdgeDriver(EdgeOptions options)
49
49
/// </summary>
50
50
/// <param name="service">The <see cref="EdgeDriverService"/> used to initialize the driver.</param>
51
51
public EdgeDriver ( EdgeDriverService service )
52
- : this ( service , new EdgeOptions ( ) )
52
+ : this ( service , new EdgeOptions ( ) { UseChromium = service . UsingChromium } )
53
53
{
54
54
}
55
55
56
56
/// <summary>
57
57
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path
58
- /// to the directory containing EdgeDriver.exe .
58
+ /// to the directory containing the WebDriver executable .
59
59
/// </summary>
60
- /// <param name="edgeDriverDirectory">The full path to the directory containing EdgeDriver.exe .</param>
60
+ /// <param name="edgeDriverDirectory">The full path to the directory containing the WebDriver executable .</param>
61
61
public EdgeDriver ( string edgeDriverDirectory )
62
62
: this ( edgeDriverDirectory , new EdgeOptions ( ) )
63
63
{
64
64
}
65
65
66
66
/// <summary>
67
67
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path
68
- /// to the directory containing EdgeDriver.exe and options.
68
+ /// to the directory containing the WebDriver executable and options.
69
69
/// </summary>
70
- /// <param name="edgeDriverDirectory">The full path to the directory containing EdgeDriver.exe .</param>
70
+ /// <param name="edgeDriverDirectory">The full path to the directory containing the WebDriver executable .</param>
71
71
/// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>
72
72
public EdgeDriver ( string edgeDriverDirectory , EdgeOptions options )
73
73
: this ( edgeDriverDirectory , options , RemoteWebDriver . DefaultCommandTimeout )
@@ -76,13 +76,13 @@ public EdgeDriver(string edgeDriverDirectory, EdgeOptions options)
76
76
77
77
/// <summary>
78
78
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path
79
- /// to the directory containing EdgeDriver.exe , options, and command timeout.
79
+ /// to the directory containing the WebDriver executable , options, and command timeout.
80
80
/// </summary>
81
- /// <param name="edgeDriverDirectory">The full path to the directory containing EdgeDriver.exe .</param>
81
+ /// <param name="edgeDriverDirectory">The full path to the directory containing the WebDriver executable .</param>
82
82
/// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>
83
83
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
84
84
public EdgeDriver ( string edgeDriverDirectory , EdgeOptions options , TimeSpan commandTimeout )
85
- : this ( EdgeDriverService . CreateDefaultService ( edgeDriverDirectory ) , options , commandTimeout )
85
+ : this ( EdgeDriverService . CreateDefaultServiceFromOptions ( edgeDriverDirectory , options ) , options , commandTimeout )
86
86
{
87
87
}
88
88
@@ -104,9 +104,30 @@ public EdgeDriver(EdgeDriverService service, EdgeOptions options)
104
104
/// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>
105
105
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
106
106
public EdgeDriver ( EdgeDriverService service , EdgeOptions options , TimeSpan commandTimeout )
107
- : base ( service , options , commandTimeout )
107
+ : base ( new DriverServiceCommandExecutor ( service , commandTimeout ) , ConvertOptionsToCapabilities ( options , service . UsingChromium ) )
108
108
{
109
109
}
110
110
111
+ private static ICapabilities ConvertOptionsToCapabilities ( EdgeOptions options , bool serviceUsingChromium )
112
+ {
113
+ if ( options == null )
114
+ {
115
+ throw new ArgumentNullException ( "options" , "options must not be null" ) ;
116
+ }
117
+
118
+ if ( serviceUsingChromium != options . UseChromium )
119
+ {
120
+ if ( serviceUsingChromium )
121
+ {
122
+ throw new WebDriverException ( "options.UseChromium must be set to true when using an Edge Chromium driver service." ) ;
123
+ }
124
+ else
125
+ {
126
+ throw new WebDriverException ( "options.UseChromium must be set to false when using an Edge Legacy driver service." ) ;
127
+ }
128
+ }
129
+
130
+ return options . ToCapabilities ( ) ;
131
+ }
111
132
}
112
133
}
0 commit comments