1616// limitations under the License.
1717// </copyright>
1818
19- using System ;
20- using System . Globalization ;
21- using System . Text ;
22- using OpenQA . Selenium . Internal ;
19+ using System . IO ;
2320using OpenQA . Selenium . Chromium ;
21+ using OpenQA . Selenium . Internal ;
2422
2523namespace OpenQA . Selenium . Edge
2624{
@@ -31,16 +29,14 @@ public sealed class EdgeDriverService : ChromiumDriverService
3129 {
3230 private const string MSEdgeDriverServiceFileName = "msedgedriver" ;
3331
34- private static readonly Uri MicrosoftWebDriverDownloadUrl = new Uri ( "https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/" ) ;
35-
3632 /// <summary>
3733 /// Initializes a new instance of the <see cref="EdgeDriverService"/> class.
3834 /// </summary>
3935 /// <param name="executablePath">The full path to the EdgeDriver executable.</param>
4036 /// <param name="executableFileName">The file name of the EdgeDriver executable.</param>
4137 /// <param name="port">The port on which the EdgeDriver executable should listen.</param>
4238 private EdgeDriverService ( string executablePath , string executableFileName , int port )
43- : base ( executablePath , executableFileName , port , MicrosoftWebDriverDownloadUrl )
39+ : base ( executablePath , executableFileName , port )
4440 {
4541 }
4642
@@ -69,10 +65,8 @@ public static EdgeDriverService CreateDefaultService()
6965 /// <returns>A EdgeDriverService that implements default settings.</returns>
7066 public static EdgeDriverService CreateDefaultService ( EdgeOptions options )
7167 {
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 ) ) ;
7670 }
7771
7872 /// <summary>
@@ -82,6 +76,11 @@ public static EdgeDriverService CreateDefaultService(EdgeOptions options)
8276 /// <returns>An EdgeDriverService using a random port.</returns>
8377 public static EdgeDriverService CreateDefaultService ( string driverPath )
8478 {
79+ if ( Path . GetFileName ( driverPath ) . Contains ( MSEdgeDriverServiceFileName ) )
80+ {
81+ driverPath = Path . GetDirectoryName ( driverPath ) ;
82+ }
83+
8584 return CreateDefaultService ( driverPath , ChromiumDriverServiceFileName ( MSEdgeDriverServiceFileName ) ) ;
8685 }
8786
0 commit comments