Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions dotnet/src/webdriver/Chrome/ChromeDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,22 @@ public static ChromeDriverService CreateDefaultService()
/// </summary>
/// <param name="driverPath">The path to the executable or the directory containing the ChromeDriver executable.</param>
/// <returns>A ChromeDriverService using a random port.</returns>
public static ChromeDriverService CreateDefaultService(string driverPath)
public static ChromeDriverService CreateDefaultService(string? driverPath)
{
string fileName;
if (File.Exists(driverPath))
{
fileName = Path.GetFileName(driverPath);
driverPath = Path.GetDirectoryName(driverPath)!;
string fileName = Path.GetFileName(driverPath);
string driverFolder = Path.GetDirectoryName(driverPath)!;

return CreateDefaultService(driverFolder, fileName);
}
else
{
fileName = ChromiumDriverServiceFileName(DefaultChromeDriverServiceExecutableName);
}
string fileName = ChromiumDriverServiceFileName(DefaultChromeDriverServiceExecutableName);
string? driverFolder = driverPath;

return CreateDefaultService(driverPath, fileName);
return CreateDefaultService(driverFolder, fileName);
}
}

/// <summary>
Expand All @@ -85,7 +87,7 @@ public static ChromeDriverService CreateDefaultService(string driverPath)
/// <param name="driverPath">The directory containing the ChromeDriver executable.</param>
/// <param name="driverExecutableFileName">The name of the ChromeDriver executable file.</param>
/// <returns>A ChromeDriverService using a random port.</returns>
public static ChromeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName)
public static ChromeDriverService CreateDefaultService(string? driverPath, string? driverExecutableFileName)
{
return new ChromeDriverService(driverPath, driverExecutableFileName, PortUtilities.FindFreePort());
}
Expand Down
20 changes: 11 additions & 9 deletions dotnet/src/webdriver/Edge/EdgeDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,24 @@ public static EdgeDriverService CreateDefaultService()
/// <summary>
/// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable.
/// </summary>
/// <param name="driverPath">The directory containing the EdgeDriver executable.</param>
/// <param name="driverPath">The path to the executable or the directory containing the EdgeDriver executable.</param>
/// <returns>An EdgeDriverService using a random port.</returns>
public static EdgeDriverService CreateDefaultService(string driverPath)
public static EdgeDriverService CreateDefaultService(string? driverPath)
{
string fileName;
if (File.Exists(driverPath))
{
fileName = Path.GetFileName(driverPath);
driverPath = Path.GetDirectoryName(driverPath)!;
string fileName = Path.GetFileName(driverPath);
string driverFolder = Path.GetDirectoryName(driverPath)!;

return CreateDefaultService(driverFolder, fileName);
}
else
{
fileName = ChromiumDriverServiceFileName(MSEdgeDriverServiceFileName);
}
string fileName = ChromiumDriverServiceFileName(MSEdgeDriverServiceFileName);
string? driverFolder = driverPath;

return CreateDefaultService(driverPath, fileName);
return CreateDefaultService(driverFolder, fileName);
}
}

/// <summary>
Expand All @@ -96,7 +98,7 @@ public static EdgeDriverService CreateDefaultService(string driverPath)
/// <param name="driverPath">The directory containing the EdgeDriver executable.</param>
/// <param name="driverExecutableFileName">The name of the EdgeDriver executable file.</param>
/// <returns>A EdgeDriverService using a random port.</returns>
public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName)
public static EdgeDriverService CreateDefaultService(string? driverPath, string? driverExecutableFileName)
{
return new EdgeDriverService(driverPath, driverExecutableFileName, PortUtilities.FindFreePort());
}
Expand Down
18 changes: 10 additions & 8 deletions dotnet/src/webdriver/Firefox/FirefoxDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,22 @@ public static FirefoxDriverService CreateDefaultService()
/// </summary>
/// <param name="driverPath">The path to the executable or the directory containing the Firefox driver executable.</param>
/// <returns>A FirefoxDriverService using a random port.</returns>
public static FirefoxDriverService CreateDefaultService(string driverPath)
public static FirefoxDriverService CreateDefaultService(string? driverPath)
{
string fileName;
if (File.Exists(driverPath))
{
fileName = Path.GetFileName(driverPath);
driverPath = Path.GetDirectoryName(driverPath)!;
string fileName = Path.GetFileName(driverPath);
string driverFolder = Path.GetDirectoryName(driverPath)!;

return CreateDefaultService(driverFolder, fileName);
}
else
{
fileName = FirefoxDriverServiceFileName();
}
string fileName = FirefoxDriverServiceFileName();
string? driverFolder = driverPath;

return CreateDefaultService(driverPath, fileName);
return CreateDefaultService(driverFolder, fileName);
}
}

/// <summary>
Expand All @@ -216,7 +218,7 @@ public static FirefoxDriverService CreateDefaultService(string driverPath)
/// <param name="driverPath">The directory containing the Firefox driver executable.</param>
/// <param name="driverExecutableFileName">The name of the Firefox driver executable file.</param>
/// <returns>A FirefoxDriverService using a random port.</returns>
public static FirefoxDriverService CreateDefaultService(string driverPath, string driverExecutableFileName)
public static FirefoxDriverService CreateDefaultService(string? driverPath, string? driverExecutableFileName)
{
return new FirefoxDriverService(driverPath, driverExecutableFileName, PortUtilities.FindFreePort());
}
Expand Down
18 changes: 10 additions & 8 deletions dotnet/src/webdriver/IE/InternetExplorerDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,22 @@ public static InternetExplorerDriverService CreateDefaultService()
/// </summary>
/// <param name="driverPath">The path to the executable or the directory containing the <c>IEDriverServer</c> executable.</param>
/// <returns>A InternetExplorerDriverService using a random port.</returns>
public static InternetExplorerDriverService CreateDefaultService(string driverPath)
public static InternetExplorerDriverService CreateDefaultService(string? driverPath)
{
string fileName;
if (File.Exists(driverPath))
{
fileName = Path.GetFileName(driverPath);
driverPath = Path.GetDirectoryName(driverPath)!;
string fileName = Path.GetFileName(driverPath);
string driverFolder = Path.GetDirectoryName(driverPath)!;

return CreateDefaultService(driverFolder, fileName);
}
else
{
fileName = InternetExplorerDriverServiceFileName;
}
string fileName = InternetExplorerDriverServiceFileName;
string? driverFolder = driverPath;

return CreateDefaultService(driverPath, fileName);
return CreateDefaultService(driverFolder, fileName);
}
}

/// <summary>
Expand All @@ -160,7 +162,7 @@ public static InternetExplorerDriverService CreateDefaultService(string driverPa
/// <param name="driverPath">The directory containing the <c>IEDriverServer</c> executable.</param>
/// <param name="driverExecutableFileName">The name of the <c>IEDriverServer</c> executable file.</param>
/// <returns>A InternetExplorerDriverService using a random port.</returns>
public static InternetExplorerDriverService CreateDefaultService(string driverPath, string driverExecutableFileName)
public static InternetExplorerDriverService CreateDefaultService(string? driverPath, string? driverExecutableFileName)
{
return new InternetExplorerDriverService(driverPath, driverExecutableFileName, PortUtilities.FindFreePort());
}
Expand Down
18 changes: 10 additions & 8 deletions dotnet/src/webdriver/Safari/SafariDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,22 @@ public static SafariDriverService CreateDefaultService()
/// </summary>
/// <param name="driverPath">The path to the executable or the directory containing the SafariDriver executable.</param>
/// <returns>A SafariDriverService using a random port.</returns>
public static SafariDriverService CreateDefaultService(string driverPath)
public static SafariDriverService CreateDefaultService(string? driverPath)
{
string fileName;
if (File.Exists(driverPath))
{
fileName = Path.GetFileName(driverPath);
driverPath = Path.GetDirectoryName(driverPath)!;
string fileName = Path.GetFileName(driverPath);
string driverFolder = Path.GetDirectoryName(driverPath)!;

return CreateDefaultService(driverFolder, fileName);
}
else
{
fileName = DefaultSafariDriverServiceExecutableName;
}
string fileName = DefaultSafariDriverServiceExecutableName;
string? driverFolder = driverPath;

return CreateDefaultService(driverPath, fileName);
return CreateDefaultService(driverFolder, fileName);
}
}

/// <summary>
Expand All @@ -125,7 +127,7 @@ public static SafariDriverService CreateDefaultService(string driverPath)
/// <param name="driverPath">The directory containing the SafariDriver executable.</param>
/// <param name="driverExecutableFileName">The name of the SafariDriver executable file.</param>
/// <returns>A SafariDriverService using a random port.</returns>
public static SafariDriverService CreateDefaultService(string driverPath, string driverExecutableFileName)
public static SafariDriverService CreateDefaultService(string? driverPath, string? driverExecutableFileName)
{
return new SafariDriverService(driverPath, driverExecutableFileName, PortUtilities.FindFreePort());
}
Expand Down