Skip to content

Fix intermittent Selenium::WebDriver::Error::UnknownError - #3008

Merged
DavidBiddle merged 2 commits into
mainfrom
fix-capybara-selenium-intermittent-error
Aug 6, 2026
Merged

Fix intermittent Selenium::WebDriver::Error::UnknownError#3008
DavidBiddle merged 2 commits into
mainfrom
fix-capybara-selenium-intermittent-error

Conversation

@DavidBiddle

@DavidBiddle DavidBiddle commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card:

We've had a longstanding issue with our Capybara tests intermittently failing with message:

Selenium::WebDriver::Error::UnknownError:
       unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}

when using recent versions of Chrome.

This is an instance of teamcapybara/capybara#2800

Previously we resolved this by pinning our CI to an older version of Chrome, then in some repos including this one we added a patch to retry tests when they hit this error.

Subsequently the root cause was identified on the Capybara issue (I believe thanks to an explanation of the error and a test case from @lfdebrux 🙌 ).

This PR:

  • adds a flag to the Chrome options which should resolve the issue
  • removes the retry patch, since it should no longer be needed

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Do the end to end tests need updating before these changes will pass?
  • Has all relevant documentation been updated?

@DavidBiddle DavidBiddle changed the title Fix capybara selenium intermittent error Fix intermittent Capybara/Selenium error Aug 6, 2026
@DavidBiddle DavidBiddle changed the title Fix intermittent Capybara/Selenium error Fix intermittent Selenium::WebDriver::Error::UnknownError Aug 6, 2026
Add the 'disable-features=DeferRendererTasksAfterInput' flag, which
resolves a longstanding issue with Selenium throwing intermittent errors
(teamcapybara/capybara#2800)
This patch is no longer needed as the
`disable-features=DeferRendererTasksAfterInput` flag resolves the issue
this is patching.
@DavidBiddle
DavidBiddle force-pushed the fix-capybara-selenium-intermittent-error branch from 2f38b84 to a6b11e7 Compare August 6, 2026 13:38
@DavidBiddle
DavidBiddle marked this pull request as ready for review August 6, 2026 13:38
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-3008.admin.review.forms.service.gov.uk/

It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

@DavidBiddle

Copy link
Copy Markdown
Contributor Author

I've tested this locally by running the content of this feature test 300 times without seeing the error (200 headless, 100 with the GUI)

@DavidBiddle
DavidBiddle added this pull request to the merge queue Aug 6, 2026
Merged via the queue into main with commit b861474 Aug 6, 2026
3 checks passed
@DavidBiddle
DavidBiddle deleted the fix-capybara-selenium-intermittent-error branch August 6, 2026 14:04
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.

2 participants