Repository navigation
Conversation
ERROR_TO_EXC_MAPPING mapped the W3C `detached shadow root` error to NoSuchShadowRootException. Selenium maps it to DetachedShadowRootException, which is not a subclass of NoSuchShadowRootException, so `except DetachedShadowRootException` never caught the error when using the Appium client. Map it to selenium's DetachedShadowRootException. Behaviour change: code that caught NoSuchShadowRootException for a detached shadow root needs to catch DetachedShadowRootException (or WebDriverException) instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ERROR_TO_EXC_MAPPINGinappium/webdriver/errorhandler.pymaps the W3Cdetached shadow rooterror toNoSuchShadowRootException. Selenium maps it toDetachedShadowRootException. The two classes are unrelated (both subclassWebDriverExceptiondirectly), so with the Appium clientexcept DetachedShadowRootExceptionnever fires:A server returns this error, for example in a webview context, when a test uses a shadow root after the page removed it from the DOM.
Fix
Map
'detached shadow root'toselenium.common.exceptions.DetachedShadowRootException. This is a one-line change.Behaviour change: code that catches
NoSuchShadowRootExceptionto handle a detached shadow root needs to catchDetachedShadowRootExceptioninstead, or both. Code catchingWebDriverExceptionis not affected.Tests
test/unit/webdriver/errorhandler_shadow_root_test.pychecks that:detached shadow rooterror raisesDetachedShadowRootException;no such shadow rooterror still raisesNoSuchShadowRootException.NoSuchShadowRootException: Message: detached shadow rootis raised instead.ruff check,ruff format --check,mypy appiumand the full unit test suite pass.🤖 Generated with Claude Code