Skip to content

Regression in 4.2.5: Appium (native) ElementNotFound hints send JavaScript to execute/sync on every not-found lookup #5812

Open

Description

@mirao

What are you trying to achieve?

Run Appium tests against a native Android app (UiAutomator2, no webview) on CodeceptJS 4.2.5, with the same clean log as on 4.2.4.

What do you get instead?

Since 4.2.5, the log has an ERROR webdriver line every time an element lookup comes back empty, even when the step then passes:

    I click "android=new UiSelector().resourceId("REQUESTS_FILTER_CHIP").description("Amy766520753392633")"
2026-11-20T09:54:09.864Z ERROR webdriver: WebDriverError: Method is not implemented when running "execute/sync" with method "POST"
    I see element "android=new UiSelector().resourceId("REQUESTS_FILTER_CHIP").description("Amy766520753392633").selected(true)"

A 9-scenario suite printed this 8 times and still passed.

The cause is the new hint collection in lib/helper/errors/ElementNotFound.js (#5798). The constructor always calls collect(). It picks the first helper that has executeScript and runs the in-page collector script through it:

const helper = Object.values(Container.helpers()).find(h => h && typeof h.executeScript === 'function')
if (!helper) return null
...
return await Promise.race([helper.executeScript(collectOnPage, this._query), timeout])

With Appium in the native app context, executeScript sends a JavaScript body to /execute/sync. UiAutomator2 accepts only mobile: commands there, so the server rejects it. This is the Appium server's answer, so no client version avoids it. The error is caught and no hints are added, so tests are not broken. It still costs:

  • a misleading ERROR line in the log for every not-found lookup, including the internal ones a passing step makes
  • one extra HTTP round trip to the Appium server for each of those lookups, and so for every retryFailedStep retry that hits a not-found

The PR says Appium is covered "through inheritance". That holds in a webview context only.

Suggested fix

Skip the collection when the helper isn't driving a web page. The Appium helper already sets isWeb (lib/helper/Appium.js, lines 258/261), so something like this in collect() would do:

if (!helper || helper.isWeb === false) return null

Separately, the explainNotFound option from #5799's description isn't in 4.2.5, so there is currently no way to turn the hints off.

Environment

  • CodeceptJS 4.2.5 (Appium helper, appiumV2: true)
  • Appium 3.1.0, UiAutomator2 driver 5.0.5
  • Android 17 emulator (Pixel phone AVD), native app, no webview
  • Runtime: Bun 1.4.4

Created by AI agent (Claude Code)

Activity

  1. changed the title [-]Appium (native): ElementNotFound hints send JavaScript to execute/sync on every not-found lookup[/-] [+]Regression in 4.2.5: Appium (native) ElementNotFound hints send JavaScript to execute/sync on every not-found lookup[/+] on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions