Repository navigation
fix: support Selenium WebDriverDecorator across AppiumFieldDecorator elements and widgets - #2498
Open
hoanle0126 wants to merge 3 commits into
Open
hoanle0126 wants to merge 3 commits into
hoanle0126 wants to merge 3 commits into
Conversation
…elements and widgets
hoanle0126
requested review from
SrinivasanTarget,
mykola-mokhnach,
saikrishna321 and
valfirst
as code owners
November 10, 2026 01:36
mykola-mokhnach
left a comment
Contributor
There was a problem hiding this comment.
src/main/java/io/appium/java_client/remote/AppiumWebElement.java:266:equalsnow treats a Selenium-decorated element as equal to anAppiumWebElement. It unwraps viaDecorated.getOriginaland comparesgetId(), buthashCodestill uses theidfield. The decorated proxy keeps its own identity hash. SoappiumElement.equals(decoratedFound)is true (the new test asserts it), yet the two have different hash codes. Putting both in aHashSetorHashMapgives duplicates or failed lookups.SearchingWidgetRootHandler.hashCodereturnsresolved.hashCode()while itsequalsunwraps decorators, so it has the same contract violation. ShouldhashCodehash the unwrapped element's id?
Contributor
Author
|
Addressed in 8df1f09. InterceptorOfASingleElement and SearchingWidgetRootHandler now hash the unwrapped element via Objects.hashCode(unwrapElement(...)) so page factory proxies, SearchingWidgetRoot, Decorated proxies, and AppiumWebElement produce matching hash codes in HashSet and HashMap. |
mykola-mokhnach
left a comment
Contributor
There was a problem hiding this comment.
Earlier threads are addressed; remaining notes are inline.
…n, and wrapper walk in ElementHelpers
mykola-mokhnach
approved these changes
Nov 11, 2026
valfirst
approved these changes
Nov 11, 2026
This branch has not been deployed
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.
Proposed Changes
Fixes #2368
Fixes #2051
This PR completes interoperability between
AppiumFieldDecoratorand Selenium'sWebDriverDecorator(such asEventFiringDecorator) as well as nested driver and element wrappers:ElementHelpersfor cachedDecoratedandWrapsElementunwrapping with cycle protection, and updatesWebDriverUnpackUtilityto unwrap nested driver and decorator wrappers without package cycles.ElementInterceptorandElementListInterceptorto resolve methods across public interfaces implemented by decorated elements, unwrap for AppiumWebElement methods, and adapt decorated items in place only for AppiumWebElement lists.Testing
SeleniumDecoratorCompatibilityTestcovering mobile locator translation through decorated and wrapped drivers, non-WebElement interface calls, AppiumWebElement methods, symmetric equality and hash codes, element lists, widgets and widget lists, and dual-wrapper / cycle unpacking.