Skip to content

fix: support Selenium-decorated page elements - #2452

Merged
mykola-mokhnach merged 1 commit into
appium:masterfrom
dlowzzxx:fix/selenium-decorator-2368
Oct 7, 2026
Merged

mykola-mokhnach merged 1 commit into
appium:masterfrom
dlowzzxx:fix/selenium-decorator-2368

Conversation

@dlowzzxx

@dlowzzxx dlowzzxx commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Change list

  • Resolve the matching public WebElement method when Appium's intercepted method cannot be invoked on a Selenium-decorated interface proxy.
  • Add a regression that verifies the underlying click and Selenium's afterClick listener each run once.

Types of changes

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

Addresses #2368.

When Selenium's EventFiringDecorator returns an element as an interface proxy, invoking a method declared by Appium's page element class on that receiver throws IllegalArgumentException. ElementInterceptor now resolves the matching WebElement method when the declaring class is incompatible with the receiver. Compatible receivers keep the original method dispatch.

The fallback invokes the decorated receiver instead of unwrapping it, preserving Selenium listener dispatch.

The regression initializes an Appium page field from a Selenium-decorated driver and checks that click() reaches the original element and its Selenium listener exactly once. After rebasing onto master 0f6e5c1d, the test uses Appium's current PageFactory package.

Validation on the rebased head with JDK 21, Gradle 9.8.0, and Selenium 4.50.0:

  • Decorator regression passes, as do all 29 page-factory tests in the full core suite. Against current upstream production with only the regression added, it fails with object is not an instance of declaring class.
  • Full core suite: 195 tests run, nine golden-comparison assertion failures. Current upstream production plus the new regression reproduces the same nine failures, plus the expected regression failure.
  • Selenium bridge suite: 12 tests pass. Root and bridge E2E sources compile and E2E Checkstyle passes; device E2E tests were not run locally.
  • Root test Checkstyle reports five missing Javadoc errors in unchanged EmptyWebDriver/TestUtils helpers, identical in the current-base comparison. The two PR files have no Checkstyle violations; git diff --check passes.

The full local build is not green because of these reproduced current-base failures. Selenium snapshot and hosted JDK/mobile matrices have not been rerun locally on this new head.

Codex assisted with implementation and validation.

@mykola-mokhnach

Copy link
Copy Markdown
Contributor

@dlowzzxx Please rebase the PR with master

@dlowzzxx
dlowzzxx force-pushed the fix/selenium-decorator-2368 branch from 8b3219e to f773ead Compare October 7, 2026 08:44
@dlowzzxx

dlowzzxx commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on 0f6e5c1d and updated the PageFactory import. The decorator regression is red on current upstream and green here; all 29 page-factory tests pass. The description records the reproduced full-suite and Javadoc failures.

@mykola-mokhnach
mykola-mokhnach merged commit 4d63fc5 into appium:master Oct 7, 2026
13 checks passed
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