Conversation
…tionType(String) getExceptionType(String) returned null for any state that is not a mobile-specific error, while getExceptionType(int) delegates to super. Selenium is moving ErrorHandler from the JSON Wire integer status to the W3C state string (SeleniumHQ/selenium#18059), after which every standard error (e.g. "no such element") would resolve to null and surface as a plain WebDriverException instead of its specific type. Delegate unmatched states to super, and guard against a null state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I was going to merge the linked PR but Claude found that this would break Appium's errors codes. I will merge the PR in Selenium and I hope you folks can do a release soon with this change. |
|
Thanks @diemol It looks like the compatibility with the latest snapshot is already broken: https://github.com/appium/java-client/actions/runs/35845286236/job/107136595938, so only this change won't be enough to keep it compatible |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Let me check that, I think we made a change and removed some fields. Do you want me to bring them back in Selenium and deprecate them or should I send a PR here fixing them? |
fixing it here won't help from the perspective that end users would still have to update their selenium api version in order to make it compatible. |
Change list
ErrorCodesMobile.getExceptionType(String)now callssuper.getExceptionType(...)for states that don't match a mobile-specific error, instead of returningnull.nullcheck on the incoming state to avoid aNullPointerExceptionatmessage.contains(...).ErrorCodesMobileTestunit tests.Types of changes
What types of changes are you proposing/introducing to Java client?
Put an
xin the boxes that applyDetails
ErrorCodesMobileoverrides both lookup methods from Selenium'sErrorCodes, but they behave differently:getExceptionType(int)handlesNO_SUCH_CONTEXTand delegates everything else tosuper.getExceptionType(String)handles"No such context found"and returnsnullfor everything else.Until now this didn't matter, because Selenium's
ErrorHandler(whichAppiumDriverinstalls withnew ErrorHandler(new ErrorCodesMobile(), true)) resolved exceptions using the integer status. Selenium is movingErrorHandlerto the W3Cstatestring instead (SeleniumHQ/selenium#18059, part of removing JSON Wire Protocol leftovers in SeleniumHQ/selenium#17638). After that change, every standard error, such as"no such element"or"stale element reference", would getnullfrom this method. Appium users would then see a plainWebDriverExceptioninstead ofNoSuchElementException,StaleElementReferenceExceptionand so on, which breakscatchblocks and waits that rely on the specific type.With this change, the String lookup behaves the same way as the int lookup:
The new tests fail on the current code (
expected: NoSuchElementException but was: null) and pass with this fix.Selenium will keep a fallback for existing Appium releases on its side, so this isn't urgent, but it makes the method correct for the upcoming change.
🤖 Generated with Claude Code