Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet] allow user to start service before creating driver #12816

Merged
merged 1 commit into from
Sep 25, 2023
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
6 changes: 6 additions & 0 deletions dotnet/src/webdriver/Chrome/ChromeDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ private ChromeDriverService(string executablePath, string executableFileName, in
{
}

/// <inheritdoc />
protected override DriverOptions GetDefaultDriverOptions()
{
return new ChromeOptions();
}

/// <summary>
/// Creates a default instance of the ChromeDriverService.
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions dotnet/src/webdriver/DriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -283,6 +288,12 @@ public void Start()
}
}

/// <summary>
/// The browser options instance that corresponds to the driver service
/// </summary>
/// <returns></returns>
protected abstract DriverOptions GetDefaultDriverOptions();

/// <summary>
/// Releases all resources associated with this <see cref="DriverService"/>.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions dotnet/src/webdriver/Edge/EdgeDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ private EdgeDriverService(string executablePath, string executableFileName, int
{
}

/// <inheritdoc />
protected override DriverOptions GetDefaultDriverOptions()
{
return new EdgeOptions();
}

/// <summary>
/// Gets or sets a value indicating whether the service should use verbose logging.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions dotnet/src/webdriver/Firefox/FirefoxDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ private FirefoxDriverService(string executablePath, string executableFileName, i
{
}

/// <inheritdoc />
protected override DriverOptions GetDefaultDriverOptions()
{
return new FirefoxOptions();
}

/// <summary>
/// Gets or sets the location of the Firefox binary executable.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions dotnet/src/webdriver/IE/InternetExplorerDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ private InternetExplorerDriverService(string executablePath, string executableFi
{
}

/// <inheritdoc />
protected override DriverOptions GetDefaultDriverOptions()
{
return new InternetExplorerOptions();
}

/// <summary>
/// Gets or sets the value of the host adapter on which the IEDriverServer should listen for connections.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions dotnet/src/webdriver/Safari/SafariDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ private SafariDriverService(string executablePath, string executableFileName, in
{
}

/// <inheritdoc />
protected override DriverOptions GetDefaultDriverOptions()
{
return new SafariOptions();
}

/// <summary>
/// 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
Expand Down
Loading