Repository navigation
Start a browser session again when the browser or its driver did not start - #39
Draft
jwrosewell wants to merge 2 commits into
Draft
jwrosewell wants to merge 2 commits into
jwrosewell wants to merge 2 commits into
Conversation
Helpers/SessionRetryTests.cs covers a session the driver did not create, a driver service that would not run, a fault in the caller, and the attempts a session is given. BrowserDrivers.Retried wraps every local Chrome, Firefox and Edge session and makes one attempt, which is what the code does today, so three of the new tests fail.
…start A driver that started the browser and could not reach it answers "session not created from disconnected: unable to connect to renderer" in about a second, which failed a test outright. Every local Chrome, Firefox and Edge session now gets up to three attempts, two seconds apart, and what stops the last attempt travels on as it is so the error a test reports does not change. Each failed attempt is written to the test's output. A remote session on a Selenium grid is left as it was, because the grid queues and answers its own session requests and no failure of that kind has been measured. The first start of Chrome and Firefox is left as it was too, since it already writes what stopped it and does not fail the run, and the test that follows it starts the browser through the attempts above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A Chrome driver that starts the browser and then cannot reach it answers
session not created from disconnected: unable to connect to renderer (SessionNotCreated), andHelpers/BrowserDrivers.csmade one attempt, so that answer failed the test outright. It has failed builds in three language repositories over the weekend of 14 to 16 November 2026.Example_RendersRealDetectionResultfailed in 931 msEach failure came back from the
ChromeDriverconstructor in about a second, withSystem.InvalidOperationExceptionand that message, so nothing in the test had run yet. 51degrees-python's own failures (run 43590775623 and run 43618020992) are a different fault in Python's own Selenium library and are not touched by this.This is a failure that a re-run clears, which is what the rule of 13 November 2026 says not to do, so it is fixed here.
What changed
BrowserDrivers.Retriedruns the call that creates a session and, when the browser or its driver did not start, runs it again up toSessionStartAttemptstimes, which is 3, waitingSessionRetryDelaySeconds, which is 2, between attempts. Every local Chrome, Firefox and Edge session goes through it, on both routes, being the driver the machine provides and the driver Selenium Manager fetches.Three things it does not do.
StartOncemakes before the first test that asks for the browser, is left as it was. It already writes what stopped it and does not fail the run, and the test that follows it starts the browser through the attempts above.Another attempt is made only when what stopped the attempt says the browser or its driver did not start, which Selenium reports as an
InvalidOperationExceptionfor a session it could not create and aWebDriverExceptionfor a driver service that would not run. A fault in the caller, such as options that are wrong, is reported at once.README.mdsays what the attempts are, beside the sentence on the time limits.Tests
Helpers/SessionRetryTests.csis new and starts no browser, so it runs in the first job of Build and test on every push and pull request.Build
tmp/retry-browser-start-redat 4ab95b2, which is these tests withSessionStartAttemptsat 1, being the one attempt the code made. Exactly three of them fail,Retried_StartsAgainWhenTheSessionWasNotCreated,Retried_StartsAgainWhenTheDriverServiceWouldNotRunandSessionStartAttempts_AllowsMoreThanOneAttempt, with 55 passed and 15 skipped, so the suite built and the red is the tests rather than the build. That branch also carried a line making Build and test run on a push to it, because the workflow runs on a push tomainand on a pull request only. It is deleted now the run has finished, and the run holds its log.This repository publishes no package, so there is no Publish dry run, no version to move and nothing to time against
main.What remains
Fetchedreports any failure on the route where the machine provides no driver as "No Chrome driver on this machine, so Selenium Manager was left to fetch one, and it could not", which reads wrongly when the real failure was a session that would not start. That is how it reads today as well, so it is left for a change of its own.git clone --depth 1with no branch in each repository'sci/run-integration-tests.ps1), so these attempts reach their builds when this repository'srcreachesmain, and not before.