Skip to content

[dotnet] quit fails after not successful new session #14242

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

Merged
Merged
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
16 changes: 13 additions & 3 deletions dotnet/src/webdriver/WebDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ protected WebDriver(ICommandExecutor executor, ICapabilities capabilities)
}
catch (Exception)
{
// Failed to start driver session, disposing of driver
this.Quit();
try
{
// Failed to start driver session, disposing of driver
this.Quit();
}
catch
{
// Ignore the clean-up exception. We'll propagate the original failure.
}
throw;
}

Expand Down Expand Up @@ -703,7 +710,10 @@ protected virtual void Dispose(bool disposing)
{
try
{
this.Execute(DriverCommand.Quit, null);
if (this.sessionId is not null)
{
this.Execute(DriverCommand.Quit, null);
}
}
catch (NotImplementedException)
{
Expand Down
Loading