[dotnet] there is more than one place that needs selenium manager logic added
@@ -64,9 +64,25 @@ protected DriverService(string servicePath, int port, string driverServiceExecut
string executablePath = Path.Combine(servicePath, driverServiceExecutableName);
if (!File.Exists(executablePath))
+ {
+ try
+ {
+ executablePath = SeleniumManager.DriverPath(driverServiceExecutableName);
+ }
+ catch (Exception e)
+ {
+ // No-op; entirely a fall-back feature
+ }
+
+ if (File.Exists(executablePath))
+ {
+ servicePath = Path.GetDirectoryName(executablePath);
+ }
+ else
{
throw new DriverServiceNotFoundException(string.Format(CultureInfo.InvariantCulture, "The file {0} does not exist. The driver can be downloaded at {1}", executablePath, driverServiceDownloadUrl));
}
+ }
this.driverServicePath = servicePath;
this.driverServiceExecutableName = driverServiceExecutableName;
@@ -296,7 +312,21 @@ protected static string FindDriverServiceExecutable(string executableName, Uri d
if (string.IsNullOrEmpty(serviceDirectory))
{
- throw new DriverServiceNotFoundException(string.Format(CultureInfo.InvariantCulture, "The {0} file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at {1}.", executableName, downloadUrl));
+ try
+ {
+ serviceDirectory = Path.GetDirectoryName(SeleniumManager.DriverPath(executableName));
+ }
+ catch (Exception e)
+ {
+ // No-op; entirely a fall-back feature
+ }
+
+ if (string.IsNullOrEmpty(serviceDirectory))
+ {
+ throw new DriverServiceNotFoundException(string.Format(CultureInfo.InvariantCulture,
+ "The {0} file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at {1}.",
+ executableName, downloadUrl));
+ }
}
return serviceDirectory;
