16
16
// limitations under the License.
17
17
// </copyright>
18
18
19
- using System ;
20
- using System . Globalization ;
21
- using System . Text ;
22
- using OpenQA . Selenium . Internal ;
19
+ using System . IO ;
23
20
using OpenQA . Selenium . Chromium ;
21
+ using OpenQA . Selenium . Internal ;
24
22
25
23
namespace OpenQA . Selenium . Edge
26
24
{
@@ -31,16 +29,14 @@ public sealed class EdgeDriverService : ChromiumDriverService
31
29
{
32
30
private const string MSEdgeDriverServiceFileName = "msedgedriver" ;
33
31
34
- private static readonly Uri MicrosoftWebDriverDownloadUrl = new Uri ( "https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/" ) ;
35
-
36
32
/// <summary>
37
33
/// Initializes a new instance of the <see cref="EdgeDriverService"/> class.
38
34
/// </summary>
39
35
/// <param name="executablePath">The full path to the EdgeDriver executable.</param>
40
36
/// <param name="executableFileName">The file name of the EdgeDriver executable.</param>
41
37
/// <param name="port">The port on which the EdgeDriver executable should listen.</param>
42
38
private EdgeDriverService ( string executablePath , string executableFileName , int port )
43
- : base ( executablePath , executableFileName , port , MicrosoftWebDriverDownloadUrl )
39
+ : base ( executablePath , executableFileName , port )
44
40
{
45
41
}
46
42
@@ -69,10 +65,8 @@ public static EdgeDriverService CreateDefaultService()
69
65
/// <returns>A EdgeDriverService that implements default settings.</returns>
70
66
public static EdgeDriverService CreateDefaultService ( EdgeOptions options )
71
67
{
72
- string serviceDirectory = DriverService . FindDriverServiceExecutable ( ChromiumDriverServiceFileName ( MSEdgeDriverServiceFileName ) ,
73
- MicrosoftWebDriverDownloadUrl ) ;
74
- EdgeDriverService service = CreateDefaultService ( serviceDirectory ) ;
75
- return DriverFinder . VerifyDriverServicePath ( service , options ) as EdgeDriverService ;
68
+ string fullServicePath = DriverFinder . FullPath ( options ) ;
69
+ return CreateDefaultService ( Path . GetDirectoryName ( fullServicePath ) , Path . GetFileName ( fullServicePath ) ) ;
76
70
}
77
71
78
72
/// <summary>
@@ -82,6 +76,11 @@ public static EdgeDriverService CreateDefaultService(EdgeOptions options)
82
76
/// <returns>An EdgeDriverService using a random port.</returns>
83
77
public static EdgeDriverService CreateDefaultService ( string driverPath )
84
78
{
79
+ if ( Path . GetFileName ( driverPath ) . Contains ( MSEdgeDriverServiceFileName ) )
80
+ {
81
+ driverPath = Path . GetDirectoryName ( driverPath ) ;
82
+ }
83
+
85
84
return CreateDefaultService ( driverPath , ChromiumDriverServiceFileName ( MSEdgeDriverServiceFileName ) ) ;
86
85
}
87
86
0 commit comments