Skip to content

Make ChromeDriver wait for navigation triggered by click - #68

Merged
uuf6429 merged 1 commit into
minkphp:mainfrom
aik099:fix/chromedriver-navigation-wait
Oct 7, 2026
Merged

uuf6429 merged 1 commit into
minkphp:mainfrom
aik099:fix/chromedriver-navigation-wait

Conversation

@aik099

@aik099 aik099 commented Oct 5, 2026

Copy link
Copy Markdown
Member

Since ChromeDriver 134 a click that triggers navigation (e.g. form submission) sometimes returns before the new page is loaded, or the navigation is cancelled entirely: https://issues.chromium.org/issues/402796660

As a result, Form tests in Chrome-based builds (chrome, chromium, edge) with Selenium 4 fail randomly (1-3 per job, different each run) because they read content of the previous page, e.g. Submit empty textarea, Advanced form second submit, Basic get form, Html 5 form radio attribute. See minkphp/driver-testsuite#110 for the discussion.

Adding the --disable-features=DeferRendererTasksAfterInput browser argument makes the ChromeDriver wait for navigation again (found in teamcapybara/capybara#2800). The argument is added to the default Chrome and Edge capabilities, so users get the fix too.

Locally on selenium/standalone-chromium:4, Form tests passed in 1 of 6 runs without the argument and in 6 of 6 runs with it.

Note: as before, a user-provided goog:chromeOptions (or ms:edgeOptions) capability replaces the default one entirely, so in that case the argument needs to be added by the user.

This PR doesn't include the fix from #67, so WindowTest hangs will still be present here.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.86%. Comparing base (acd45d2) to head (4d07cf6).

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #68      +/-   ##
============================================
- Coverage     89.06%   88.86%   -0.21%     
  Complexity      197      197              
============================================
  Files             1        1              
  Lines           494      494              
============================================
- Hits            440      439       -1     
- Misses           54       55       +1     
Flag Coverage Δ
chrome 88.25% <ø> (-0.21%) ⬇️
chromium 87.85% <ø> (ø)
edge 88.25% <ø> (ø)
firefox 88.05% <ø> (ø)
selenium-2.53.1 87.04% <ø> (ø)
selenium-3 88.05% <ø> (ø)
selenium-4 88.46% <ø> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aik099

aik099 commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

Comparison of the reference main build (run) vs this PR (run):

Matrix entries main This PR Result
Selenium 4: chrome (PHP 7.4-8.3), chromium, edge ❌ random Form failures in 5 of 7 jobs (Submit empty textarea, Multi input, Basic get form, Advanced form, Html 5 types, etc.) + WindowTest hangs ❌ WindowTest hangs only, no Form failures in any of 7 jobs Form failures fixed
Selenium 4: firefox ❌ HoverTest + WindowTest hangs ❌ same not affected (not Chromium-based)
Selenium 3: chrome, firefox ❌ WindowTest hangs ❌ WindowTest hangs (firefox only) not affected
Selenium 2.53.1: chrome, firefox ✅ pass ✅ pass no change
Static analysis ❌ unmatched ignoreErrors patterns ❌ same unrelated

The WindowTest hangs are fixed in #67 and the Firefox HoverTest failures will be addressed separately.

For extra context: in the 4 CI runs of #67 (which doesn't include this fix), Form failures happened in 4-7 of the 7 Chrome-based jobs on every run.

ChromeDriver 134+ sometimes returns from click before the triggered
navigation completes (or cancels it), making form submission flaky.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aik099
aik099 force-pushed the fix/chromedriver-navigation-wait branch from b2ea86d to 4d07cf6 Compare October 6, 2026 08:23
@aik099

aik099 commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

Rebased on main after #67: all Chrome-based jobs (chrome, chromium, edge) are now green (run). The only remaining failures are Firefox + Selenium 4 HoverTest (#69) and static analysis.

@stof

stof commented Oct 6, 2026

Copy link
Copy Markdown
Member

Looks good to me.
We should probably do the same in Selenium2Driver btw.

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.

3 participants