Skip to content

Commit c9d0e35

Browse files
committed
[dotnet] only use driver directory when full file path provided
1 parent 1ba6a8c commit c9d0e35

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

dotnet/src/webdriver/Chrome/ChromeDriverService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static ChromeDriverService CreateDefaultService(ChromeOptions options)
6767
/// <returns>A ChromeDriverService using a random port.</returns>
6868
public static ChromeDriverService CreateDefaultService(string driverPath)
6969
{
70-
if (Path.GetFileName(driverPath).Contains(DefaultChromeDriverServiceExecutableName))
70+
if (File.Exists(driverPath))
7171
{
7272
driverPath = Path.GetDirectoryName(driverPath);
7373
}

dotnet/src/webdriver/Edge/EdgeDriverService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static EdgeDriverService CreateDefaultService(EdgeOptions options)
7676
/// <returns>An EdgeDriverService using a random port.</returns>
7777
public static EdgeDriverService CreateDefaultService(string driverPath)
7878
{
79-
if (Path.GetFileName(driverPath).Contains(MSEdgeDriverServiceFileName))
79+
if (File.Exists(driverPath))
8080
{
8181
driverPath = Path.GetDirectoryName(driverPath);
8282
}

dotnet/src/webdriver/Firefox/FirefoxDriverService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public static FirefoxDriverService CreateDefaultService(FirefoxOptions options)
230230
/// <returns>A FirefoxDriverService using a random port.</returns>
231231
public static FirefoxDriverService CreateDefaultService(string driverPath)
232232
{
233-
if (Path.GetFileName(driverPath) == FirefoxDriverServiceFileName())
233+
if (File.Exists(driverPath))
234234
{
235235
driverPath = Path.GetDirectoryName(driverPath);
236236
}

dotnet/src/webdriver/IE/InternetExplorerDriverService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static InternetExplorerDriverService CreateDefaultService(InternetExplore
169169
/// <returns>A InternetExplorerDriverService using a random port.</returns>
170170
public static InternetExplorerDriverService CreateDefaultService(string driverPath)
171171
{
172-
if (Path.GetFileName(driverPath) == InternetExplorerDriverServiceFileName)
172+
if (File.Exists(driverPath))
173173
{
174174
driverPath = Path.GetDirectoryName(driverPath);
175175
}

dotnet/src/webdriver/Safari/SafariDriverService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public static SafariDriverService CreateDefaultService(SafariOptions options)
180180
/// <returns>A SafariDriverService using a random port.</returns>
181181
public static SafariDriverService CreateDefaultService(string driverPath)
182182
{
183-
if (Path.GetFileName(driverPath) == DefaultSafariDriverServiceExecutableName)
183+
if (File.Exists(driverPath))
184184
{
185185
driverPath = Path.GetDirectoryName(driverPath);
186186
}

0 commit comments

Comments
 (0)