Skip to content

Remote session time limit, Chromium arguments in one place and quiet driver services, from #7 - #37

Merged
jwrosewell merged 4 commits into
rcfrom
fix/driver-hardening-from-7
Nov 16, 2026
Merged

jwrosewell merged 4 commits into
rcfrom
fix/driver-hardening-from-7

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Three parts of #7, "FIX: Harden WebDriver creation so browser tests stop timing out", by James Rogers, brought onto the browser code rc now has. #7 builds its own Helpers/WebDriverFactory.cs, whilst #28 and #34 have since put driver creation in Helpers/BrowserDrivers.cs, so #7 no longer merges. These three parts are made in BrowserDrivers instead.

What is taken from #7

  1. Remote sessions get the session time limit. TryCreateRemote created its RemoteWebDriver with Selenium's 60 second default for each command. The new BrowserDrivers.CreateRemote passes SessionTimeoutSeconds, the 300 seconds local Chrome and Firefox sessions already have, which came from measured starts on the runners (Give every Chrome and Firefox session the first start's time limit #34). FIX: Harden WebDriver creation so browser tests stop timing out #7 proposed 120 seconds. Every remote session gets it, whichever browser, because TryCreateRemote serves them all, and the 51Did harness's Harness.Start now creates its remote sessions through CreateRemote too (commit 8824aba).
  2. Chrome's two arguments in one place. CreateChrome now adds --no-sandbox and --disable-dev-shm-usage through AddChromeArguments, skipping any the caller already set, as FIX: Harden WebDriver creation so browser tests stop timing out #7 does. The copies that Selenium/DriverSmokeTests.cs, Selenium/FirstStartTests.cs, Selenium/SessionLimitTests.cs and ThirdPartyCookieTests.cs added by hand go, and the remote path no longer adds Chrome's a second time. Browser51Did/Harness.cs creates its Chrome itself rather than through CreateChrome, so Harness.NewChrome now calls AddChromeArguments in place of its own copy. The one copy that stays is in DriverSmokeTests.cs, which passes them to Edge, whose options CreateChrome never sees.
  3. Quiet driver services. ChromeService and FirefoxService create every Chrome and Firefox driver service with no start up banner and no console window, and the Chrome one with no verbose or appended log, as FIX: Harden WebDriver creation so browser tests stop timing out #7's Quieten does. The 51Did harness's local Chrome and Firefox use them too, and are given SessionTimeoutSeconds for each command where they had Selenium's 60 seconds, so every local Chrome and Firefox session in the suite now has the limit Give every Chrome and Firefox session the first start's time limit #34 describes.

README.md says all three under "How a run is wired".

What is not taken, and why

How it was checked

The new Selenium/DriverSettingsTests.cs has seven tests. The first five reach the new members by name, so on a commit without them they fail when they run rather than stopping the build.

  • ChromeArguments_AddedOnce_CallersOwnKept, RemoteSession_HasTheSessionLimit, ChromeService_IsQuiet and FirefoxService_IsQuiet need no browser and run in build-and-test. The remote test answers the session's two requests itself, creating it and deleting it, and reads the limit Selenium gives each command.
  • CreateChrome_GivesTheChromeArguments, in the Browser category, starts Chrome through CreateChrome with options that name only --headless, and checks that the options then carry both arguments.
  • HarnessRemoteSessions_HaveTheSessionLimit points SELENIUM_URL at the same stand-in for its own duration, and checks the limit of the harness's remote Chrome and Firefox sessions. It runs in build-and-test, and at ded5a53, before the harness change, it failed with 1:00 against the expected 5:00.
  • HarnessLocalSessions_StartWithTheSessionLimit, in the Browser category, starts the harness's local Chrome and Firefox, loads a page in each and checks their limit. The 51Did tests skip without a cloud, so this is the first test in this repository's own checks to start the harness's browsers.

Red, run 43866844549, on the tests alone (d2bfb1e).

  • build-and-test: the four tests failed with "BrowserDrivers has no AddChromeArguments", "has no CreateRemote", "has no ChromeService" and "has no FirefoxService".
  • On ubuntu-latest and ubuntu-22.04-arm, CreateChrome_GivesTheChromeArguments failed with "CreateChrome must give --no-sandbox. The options hold: --headless".
  • On ubuntu-24.04-arm the same test's Chrome, given only --headless, exited as it started ("session not created: Chrome instance exited"). The other Chrome tests in that job, which added --no-sandbox themselves, passed, and with the change this test passes there too.

Green, run 43868454987, with the change (7c05339), and run 43871733431 with the harness change as well (8824aba).

  • At 8824aba, build-and-test ran 67 tests, of which 52 passed and 15 skipped, being the tests that need a browser, the cloud or keys, which that job leaves out.
  • At 8824aba, the browser job passed 8 of 9 on each of ubuntu-latest, ubuntu-22.04-arm and ubuntu-24.04-arm, with Edge_RunsThePage skipped as it always is.
  • At 7c05339 the same jobs gave 51 of 66 and 7 of 8, before the two harness tests were added.
  • Locally on Windows, with Chrome 157 and Firefox, the same two filters at 8824aba gave the same counts.

What remains

…sion limit

DriverSettingsTests checks that BrowserDrivers adds --no-sandbox and
--disable-dev-shm-usage to Chrome's options once each, keeping the caller's
own, that CreateChrome gives them, that the Chrome and Firefox driver
services are quiet, and that a remote session gets the session time limit.
The remote test answers the session's two requests itself, so it needs no
browser. The members are reached by name, so these fail here rather than
stopping the build.
…ne place, and quiet driver services

From #7, by James Rogers.

- CreateRemote creates every remote session with SessionTimeoutSeconds for
  each command, as local Chrome and Firefox sessions already have, in place
  of Selenium's 60 seconds.
- CreateChrome adds --no-sandbox and --disable-dev-shm-usage through
  AddChromeArguments, skipping any the caller already set. The copies four
  tests added by hand go, and the remote path no longer adds Chrome's twice.
- ChromeService and FirefoxService make every Chrome and Firefox driver
  service print no start up banner and open no console window, and the
  Chrome one write no verbose or appended log.

The Browser51Did harness keeps its own two arguments, because it creates
its driver directly rather than through CreateChrome. Edge is unchanged.
The harness starts its browsers itself rather than through CreateChrome,
and on a grid it made its own RemoteWebDriver with Selenium's 60 seconds.
The test points SELENIUM_URL at the stand-in remote for its own duration
and checks the harness's remote Chrome and Firefox sessions. It fails
here with 1:00 against the expected 5:00.
…nd Chrome's arguments

Harness.Start made its own RemoteWebDriver with Selenium's 60 seconds, and
its local ChromeDriver and FirefoxDriver with the default services and the
same 60 seconds. It now creates remote sessions through
BrowserDrivers.CreateRemote, and local ones with BrowserDrivers.ChromeService
and FirefoxService and SessionTimeoutSeconds. NewChrome gives Chrome's two
arguments through BrowserDrivers.AddChromeArguments in place of its own
copy, so every Chrome in the suite gets them from one place.

HarnessLocalSessions_StartWithTheSessionLimit starts the harness's local
Chrome and Firefox on every runner, which nothing else in this repository's
CI does, as the 51Did tests skip without a cloud.

The ChromeArguments summary says what the two arguments do, and the remote
helper's comment holds for both of its callers.
@jwrosewell
jwrosewell marked this pull request as ready for review November 16, 2026 13:08
@jwrosewell
jwrosewell merged commit c33ac84 into rc Nov 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant