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

[wasm][test-browser] Add another case for retrying chromedriver launch #370

Merged
merged 1 commit into from
Nov 23, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using OpenQA.Selenium.Chrome;
using SeleniumLogLevel = OpenQA.Selenium.LogLevel;
using OpenQA.Selenium;
using System.Linq;

namespace Microsoft.DotNet.XHarness.CLI.Commands.Wasm
{
Expand Down Expand Up @@ -101,6 +102,12 @@ protected override async Task<ExitCode> InvokeInternal(ILogger logger)
//
// So -> use a larger timeout!

string[] err_snippets = new []
{
"exited abnormally",
"Cannot start the driver service"
};

int max_retries = 3;
int retry_num = 0;
while(true)
Expand All @@ -109,11 +116,11 @@ protected override async Task<ExitCode> InvokeInternal(ILogger logger)
{
return (driverService, new ChromeDriver(driverService, options, _arguments.Timeout));
}
catch (WebDriverException wde) when (wde.Message.Contains("exited abnormally") && retry_num < max_retries - 1)
catch (WebDriverException wde) when (err_snippets.Any(s => wde.Message.Contains(s)) && retry_num < max_retries - 1)
{
// chrome can sometimes crash on startup when launching from chromedriver.
// As a *workaround*, let's retry that a few times
// Error seen:
// Example error seen:
// [12:41:07] crit: OpenQA.Selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally.
// (chrome not reachable)

Expand Down