Skip to content

Unpin selenium to fix CI flakiness against current Chrome - #3955

Open
T4rk1n wants to merge 2 commits into
devfrom
fix/unpin-selenium
Open

Unpin selenium to fix CI flakiness against current Chrome#3955
T4rk1n wants to merge 2 commits into
devfrom
fix/unpin-selenium

Conversation

@T4rk1n

@T4rk1n T4rk1n commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Problem

Recent pushes and PRs have been going red intermittently across the browser-based integration tests. The failures are scattered across unrelated Selenium tests (test_persistence, test_csp, test_multi_output, test_derived_props, async callbacks, table server tests…), a different subset each run, all surfacing as StaleElementReferenceException / TimeoutException. That pattern is environmental flakiness, not a bad merge (which would fail the same test deterministically).

Root cause

  • requirements/testing.txt pinned selenium>=3.141.0,<=4.2.0 (selenium 4.2.0 is from 2022).
  • Every CI browser job uses browser-actions/setup-chrome@v1 with chrome-version: stableunpinned — so CI now installs Chrome 151.
  • Selenium 4.2 predates Selenium Manager (added in 4.6), so it cannot reliably provision/drive current Chrome, producing timing/staleness flakiness.

Two amplifiers: the dependabot pip bump that would have raised selenium never landed on dev, and the recent React 18/19 test matrix roughly doubled the browser shards, so a single flake reddens the whole run more often.

Fix

Bump the pin to selenium>=4.11.0,<=4.46.0. The >=4.11.0 floor guarantees a mature Selenium Manager that auto-provisions a chromedriver matching whatever stable Chrome CI installs (this is why install-chromedriver: false in the setup step remains correct).

Compatibility checks

  • No removed find_element_by_* APIs anywhere in dash/ (those were dropped in selenium 4.3).
  • Driver construction already uses the modern API: webdriver.Chrome(options=...) / webdriver.Remote(command_executor=..., options=...).
  • Verified the full API surface dash/testing/browser.py uses, plus Selenium Manager availability, against selenium 4.46.0.

Follow-ups (not in this PR)

  • A few tests exhaust all 3 reruns (e.g. test_async_cbsc001_simple_callback) and may be genuinely broken rather than flaky — worth a targeted look once this settles the noise.
  • Optionally pin Chrome for fully reproducible runs; modern selenium tracks stable fine either way.

T4rk1n added 2 commits August 18, 2026 16:39
The testing requirements capped selenium at <=4.2.0 (2022), which predates
Selenium Manager. CI installs the current stable Chrome (now 151) via an
unpinned browser-actions/setup-chrome, and selenium 4.2 cannot reliably
provision or drive it, producing scattered StaleElementReferenceException /
TimeoutException failures across unrelated browser integration tests on
every push and PR.

Require selenium>=4.11.0 (mature Selenium Manager auto-provisions a matching
chromedriver) up to the current latest 4.46.0.
Unpinning selenium exposed two deterministic breaks the 4.2.0 cap had hidden:

- browser.py set the 'marionette' Firefox capability, which modern
  selenium/geckodriver reject with InvalidArgumentException (marionette is
  the implicit, only protocol now). Removed it.
- Three test modules used the find_element(s)_by_* helper methods that
  selenium removed in 4.3. Migrated them to find_element(s)(By.*, ...).
@T4rk1n

T4rk1n commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up commit 1845c32: the first CI run surfaced two deterministic breaks that the old selenium<=4.2.0 cap had been masking (both now fixed):

  1. dash/testing/browser.py set the Firefox marionette capability, which modern selenium/geckodriver reject (InvalidArgumentException: marionette is not the name of a known capability). It's the implicit protocol now — removed. This is what failed the Lint & Unit jobs (test_browser_smoke[Firefox]).
  2. Three test modules used the find_element(s)_by_* helper methods that selenium removed in 4.3 (AttributeError: 'WebElement' object has no attribute 'find_element_by_tag_name'). Migrated to find_element(s)(By.*, ...). This failed a Main Dash Chrome group.

Remaining StaleElementReferenceException flakes in that first run should be resolved by the selenium bump itself (matching driver for Chrome 151). Re-running CI to confirm.

@sonarqubecloud

Copy link
Copy Markdown

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