diff --git a/dotnet/src/webdriver/Chrome/ChromeDriverService.cs b/dotnet/src/webdriver/Chrome/ChromeDriverService.cs index 5e046ddbc03db..4c3bbcd479259 100644 --- a/dotnet/src/webdriver/Chrome/ChromeDriverService.cs +++ b/dotnet/src/webdriver/Chrome/ChromeDriverService.cs @@ -41,6 +41,12 @@ private ChromeDriverService(string executablePath, string executableFileName, in { } + /// + protected override DriverOptions GetDefaultDriverOptions() + { + return new ChromeOptions(); + } + /// /// Creates a default instance of the ChromeDriverService. /// diff --git a/dotnet/src/webdriver/DriverService.cs b/dotnet/src/webdriver/DriverService.cs index d011a6b6a51aa..11e1b91c5f9d2 100644 --- a/dotnet/src/webdriver/DriverService.cs +++ b/dotnet/src/webdriver/DriverService.cs @@ -262,6 +262,11 @@ public void Start() return; } + if (this.driverServicePath == null) + { + DriverFinder.FullPath(this.GetDefaultDriverOptions()); + } + this.driverServiceProcess = new Process(); this.driverServiceProcess.StartInfo.FileName = Path.Combine(this.driverServicePath, this.driverServiceExecutableName); this.driverServiceProcess.StartInfo.Arguments = this.CommandLineArguments; @@ -283,6 +288,12 @@ public void Start() } } + /// + /// The browser options instance that corresponds to the driver service + /// + /// + protected abstract DriverOptions GetDefaultDriverOptions(); + /// /// Releases all resources associated with this . /// diff --git a/dotnet/src/webdriver/Edge/EdgeDriverService.cs b/dotnet/src/webdriver/Edge/EdgeDriverService.cs index 429f0186a5375..c1cbb3641ce0d 100644 --- a/dotnet/src/webdriver/Edge/EdgeDriverService.cs +++ b/dotnet/src/webdriver/Edge/EdgeDriverService.cs @@ -41,6 +41,12 @@ private EdgeDriverService(string executablePath, string executableFileName, int { } + /// + protected override DriverOptions GetDefaultDriverOptions() + { + return new EdgeOptions(); + } + /// /// Gets or sets a value indicating whether the service should use verbose logging. /// diff --git a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs index 2d82cb8ed144a..6345760e83a3d 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs @@ -50,6 +50,12 @@ private FirefoxDriverService(string executablePath, string executableFileName, i { } + /// + protected override DriverOptions GetDefaultDriverOptions() + { + return new FirefoxOptions(); + } + /// /// Gets or sets the location of the Firefox binary executable. /// diff --git a/dotnet/src/webdriver/IE/InternetExplorerDriverService.cs b/dotnet/src/webdriver/IE/InternetExplorerDriverService.cs index d30355ed29567..aa47aabddf3b0 100644 --- a/dotnet/src/webdriver/IE/InternetExplorerDriverService.cs +++ b/dotnet/src/webdriver/IE/InternetExplorerDriverService.cs @@ -48,6 +48,12 @@ private InternetExplorerDriverService(string executablePath, string executableFi { } + /// + protected override DriverOptions GetDefaultDriverOptions() + { + return new InternetExplorerOptions(); + } + /// /// Gets or sets the value of the host adapter on which the IEDriverServer should listen for connections. /// diff --git a/dotnet/src/webdriver/Safari/SafariDriverService.cs b/dotnet/src/webdriver/Safari/SafariDriverService.cs index 37f811758ca0b..4f5d1a4e9d055 100644 --- a/dotnet/src/webdriver/Safari/SafariDriverService.cs +++ b/dotnet/src/webdriver/Safari/SafariDriverService.cs @@ -46,6 +46,12 @@ private SafariDriverService(string executablePath, string executableFileName, in { } + /// + protected override DriverOptions GetDefaultDriverOptions() + { + return new SafariOptions(); + } + /// /// Gets or sets a value indicating whether to use the default open-source project /// dialect of the protocol instead of the default dialect compliant with the