Skip to content

Add workaround for Chrome/Chromedriver issue - #2252

Open
lfdebrux wants to merge 2 commits into
mainfrom
ldeb-add-chromedriver-error-workaround
Open

Add workaround for Chrome/Chromedriver issue#2252
lfdebrux wants to merge 2 commits into
mainfrom
ldeb-add-chromedriver-error-workaround

Conversation

@lfdebrux

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/bFuui8d7/3458-unpin-alpine-version-in-forms-e2e-tests-once-chromedriver-issue-is-fixed

Capybara issue 2800 has still not been resolved upstream in Chrome, or in Chromedriver, Selenium, or Capybara.

In our tests in GitHub Actions we were pinning Chrome to a version not affected by this, but that version is getting quite old. We would like to stop pinning the version of Chrome.

Instead this PR cherry-picks the Capybara workaround we've used in other repos to make Capybara treat this error as retryable, hopefully preventing the errors from surfacing. This PR then also unpins Chrome in our CI tests.

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?

thomasiles and others added 2 commits July 28, 2026 12:40
Our feature tests using Capybara and Chromedriver are intermittently failing with the following error:

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

This can usually be fixed by rerunning the tests.

In our CI environments and end-to-end tests we pin chrome to 128 where
the issue doesn't occur.

It's harder to pin chrome in local development environments.

This commit takes a different approach found in a comment on the
capabara issue: It adds a monkey patch to the Selenium driver to
intercept the initialization of `UnknownError` and raise a
`StaleElementReferenceError` instead.

This makes the test retry.

This commit can be reverted once the issue is resolved.

teamcapybara/capybara#2800

unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}
@github-actions

Copy link
Copy Markdown
Contributor

🎉 A review copy of this PR has been deployed! It is made of up two components

  1. A review copy of forms-runner
  2. A production copy of forms-admin

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

I've just merged a fix in forms-admin based on the most recent update in the Chromedriver issue, I think if that turns out to be stable we can avoid implementing the workaround here

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