Lombiq/UI-Testing-Toolbox

"Creating the web driver failed" exception recently on GitHub-hosted Linux runners for Edge (OSOE-668)

Piedone opened this issue · 6 comments

Only on GitHub-hosted Linux runners (not Windows ones, and at least not locally happening under Windows 11 either) OSOCE UI testing is stuck on this error:

 OpenQA.Selenium.WebDriverException : Creating the web driver failed with the message "The HTTP request to the remote WebDriver server for URL http://localhost:39077/session timed out after 60 seconds.". This can mean that there is a leftover web driver process that you have to kill manually. Full exception: OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:39077/session timed out after 60 seconds.
 ---> System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.
 ---> System.TimeoutException: The operation was canceled.
 ---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
 ---> System.IO.IOException: Unable to read data from the transport connection: Operation canceled.
 ---> System.Net.Sockets.SocketException (125): Operation canceled
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
   --- End of inner exception stack trace ---
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
   at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Edge.EdgeDriver..ctor(EdgeDriverService service, EdgeOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Edge.EdgeDriver..ctor(EdgeDriverService service, EdgeOptions options)
   at Lombiq.Tests.UI.Services.WebDriverFactory.<>c__DisplayClass2_0.<CreateEdgeDriver>b__0() in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/WebDriverFactory.cs:line 72
   at Lombiq.Tests.UI.Services.WebDriverFactory.CreateDriver[TDriver](String browserName, Func`1 driverFactory) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/WebDriverFactory.cs:line 169
---- OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:39077/session timed out after 60 seconds.
-------- System.Threading.Tasks.TaskCanceledException : The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.
------------ System.TimeoutException : The operation was canceled.
---------------- System.Threading.Tasks.TaskCanceledException : The operation was canceled.
-------------------- System.IO.IOException : Unable to read data from the transport connection: Operation canceled.
------------------------ System.Net.Sockets.SocketException : Operation canceled
  Stack Trace:
     at Lombiq.Tests.UI.Services.WebDriverFactory.CreateDriver[TDriver](String browserName, Func`1 driverFactory) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/WebDriverFactory.cs:line 173
   at Lombiq.Tests.UI.Services.WebDriverFactory.CreateEdgeDriver(BrowserConfiguration configuration, TimeSpan pageLoadTimeout) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/WebDriverFactory.cs:line 61
   at Lombiq.Tests.UI.Services.AtataFactory.<CreateDriver>g__From|2_0[T](Func`3 factory, <>c__DisplayClass2_0& ) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/AtataFactory.cs:line 66
   at Lombiq.Tests.UI.Services.AtataFactory.CreateDriver(BrowserConfiguration browserConfiguration, TimeoutConfiguration timeoutConfiguration, ITestOutputHelper testOutputHelper) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/AtataFactory.cs:line 86
   at Lombiq.Tests.UI.Services.AtataFactory.StartAtataScope(ITestOutputHelper testOutputHelper, Uri baseUri, OrchardCoreUITestExecutorConfiguration configuration) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/AtataFactory.cs:line 33
   at Lombiq.Tests.UI.Services.UITestExecutionSession`1.CreateContextAsync() in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/UITestExecutionSession.cs:line 635
   at Lombiq.Tests.UI.Services.UITestExecutionSession`1.SetupAsync() in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/UITestExecutionSession.cs:line 498
   at Lombiq.Tests.UI.Services.UITestExecutionSession`1.ExecuteAsync(Int32 retryCount, String dumpRootPath) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/UITestExecutionSession.cs:line 95
   at Lombiq.Tests.UI.Services.UITestExecutionSession`1.ExecuteAsync(Int32 retryCount, String dumpRootPath) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/UITestExecutionSession.cs:line 136
   at Lombiq.Tests.UI.Services.UITestExecutionSession`1.ExecuteAsync(Int32 retryCount, String dumpRootPath) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/UITestExecutionSession.cs:line 149
   at Lombiq.Tests.UI.Services.UITestExecutor.ExecuteOrchardCoreTestInnerAsync[TEntryPoint](UITestManifest testManifest, OrchardCoreUITestExecutorConfiguration configuration, String dumpRootPath) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/UITestExecutor.cs:line 83
   at Lombiq.Tests.UI.Services.UITestExecutor.ExecuteOrchardCoreTestInnerAsync[TEntryPoint](UITestManifest testManifest, OrchardCoreUITestExecutorConfiguration configuration, String dumpRootPath) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/UITestExecutor.cs:line 83
   at Lombiq.Tests.UI.OrchardCoreUITestBase`1.ExecuteTestAsync(Func`2 testAsync, Browser browser, Func`2 setupOperation, Func`2 changeConfigurationAsync) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/OrchardCoreUITestBase.cs:line 261
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
   at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Edge.EdgeDriver..ctor(EdgeDriverService service, EdgeOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Edge.EdgeDriver..ctor(EdgeDriverService service, EdgeOptions options)
   at Lombiq.Tests.UI.Services.WebDriverFactory.<>c__DisplayClass2_0.<CreateEdgeDriver>b__0() in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/WebDriverFactory.cs:line 72
   at Lombiq.Tests.UI.Services.WebDriverFactory.CreateDriver[TDriver](String browserName, Func`1 driverFactory) in /home/runner/work/Open-Source-Orchard-Core-Extensions/Open-Source-Orchard-Core-Extensions/test/Lombiq.UITestingToolbox/Lombiq.Tests.UI/Services/WebDriverFactory.cs:line 169
----- Inner Stack Trace -----
   at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
----- Inner Stack Trace -----

----- Inner Stack Trace -----
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
----- Inner Stack Trace -----
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
----- Inner Stack Trace -----

Jira issue

@DAud-IcI is this something you could also please look into?

I will check it out this weekend.

Thanks!

Turns out the problem was with msedgedriver itself. I'm not sure why it suddenly popped up, but (after much setup) thankfully I managed to locally repro it in my Linux setup locally.

It looks like when the driver can't find the correct binary name it defaults back to /usr/bin/chromium for whatever reason. On Windows the binary is always msedge.exe so that's easy. I assume that's what the driver looks for on other systems too, but in Linux (including ubuntu-latest on GH) it's actually microsoft-edge-stable.

Great catch!