Skip to content

I did check this change with codeceptjs v3.6.7 and seems it's not working. I have native android app and when I open the app and check "this.browser.isW3C" it's false and "this.browser.isMobile" is true. base on new condition it will do touchClick which gave me error: #4634

Closed

Description

@mjalav
          I did check this change with codeceptjs v3.6.7 and seems it's not working. I have native android app and when I open the app and check  "this.browser.isW3C" it's false and "this.browser.isMobile" is true. base on new condition it will do touchClick which gave me error:

ERROR webdriver: WebDriverError: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource when running "touch/click" with method "POST" and args "{"element":"00000000-0000-010f-ffff-ffff00000031"}"

I reverted your code changes locally and I see it perform element click action which pass my test.

My question is about how "this.browser.isW3C" should drive a decision for touchClick or elementClick. seems like unrelated and make error.
Would you please reconsider this change?
(Fail) New changes: const clickMethod = this.browser.isMobile && !this.browser.isW3C ? 'touchClick' : 'elementClick';
(pass) Old changes: const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';

Originally posted by @mjalav in #3414 (comment)

Activity

  1. mikk150 commented on Dec 11, 2024

    @mikk150
    Contributor

    My question is about how "this.browser.isW3C" should drive a decision for touchClick or elementClick. seems like unrelated and make error. Would you please reconsider this change? (Fail) New changes: const clickMethod = this.browser.isMobile && !this.browser.isW3C ? 'touchClick' : 'elementClick'; (pass) Old changes: const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';

    Because if this.browser.isW3C===true then you cannot use touchClick(and basically anything touch related) as this is not valid W3C method(At least that is what Selenium error told me)

    Problem could also be in this.browser.isW3C is somehow wrong in your case?

  2. mirao commented on Aug 16, 2025

    @mirao
    Contributor

    @mikk150

    I have the same issue. It started when I upgraded WebDriverIO from 8.x to 9.x.

    The methods I.click() or I.checkOption() in a web view of our React Native app stopped working (ERROR webdriver: WebDriverError: unknown command: Cannot call non W3C standard command while in W3C mode when running "touch/click").

    A problem is that in WebDriverIO 9.x the method isW3C() was changed (webdriverio/webdriverio#12987). Newly it requires the "appium" prefix in capabilities

    https://github.com/webdriverio/webdriverio/blob/df3ec33741d11d196adad148f4d066a3fcbcd51b/packages/wdio-utils/src/envDetector.ts#L30-L34

        const isAppium = Boolean(
            capabilities['appium:automationName'] ||
            capabilities['appium:deviceName'] ||
            capabilities['appium:appiumVersion']
        )

    but in CodeceptJS there is no prefix "appium" in capabilities and therefore this.browser.isW3C returns false in CodeceptJS 🐛 . This is what my CodeceptJS project contains in this.browser.capabilities:

    {
        "platformName": "Android",
        "automationName": "UiAutomator2",
        "appNew": "http://localhost:8092/client-school-personal.apk",
        "appOld": "http://localhost:8092/client-school-old-personal.apk",
        "platformVersion": "15",
        "noReset": true,
        "adbExecTimeout": 300000,
        "newCommandTimeout": 3600,
        "showChromedriverLog": true,
        "recreateChromeDriverSessions": true,
        "platform": "LINUX",
        "webStorageEnabled": false,
        "takesScreenshot": true,
        "javascriptEnabled": true,
        "databaseEnabled": false,
        "networkConnectionEnabled": true,
        "locationContextEnabled": false,
        "warnings": {},
        "desired": {
            "platformName": "Android",
            "automationName": "UiAutomator2",
            "appNew": "http://localhost:8092/client-school-personal.apk",
            "appOld": "http://localhost:8092/client-school-old-personal.apk",
            "platformVersion": "15",
            "noReset": true,
            "adbExecTimeout": 300000,
            "newCommandTimeout": 3600,
            "showChromedriverLog": true,
            "recreateChromeDriverSessions": true
        },
        "deviceName": "emulator-5556",
        "deviceUDID": "emulator-5556",
        "pixelRatio": "2",
        "statBarHeight": 48,
        "viewportRect": {
            "left": 0,
            "top": 48,
            "width": 2560,
            "height": 1552
        },
        "deviceApiLevel": 35,
        "deviceManufacturer": "Google",
        "deviceModel": "Pixel Tablet",
        "deviceScreenSize": "2560x1600",
        "deviceScreenDensity": 320
    }

    In WebDriverIO 8.x the detection works better for CodeceptJS, because they take also the properties without the "appium" prefix and therefore this.browser.isW3C returns true in CodeceptJS ✔️ .

    https://github.com/webdriverio/webdriverio/blob/8f557271fbf5579061cd4bb2151871b0832cf811/packages/wdio-utils/src/envDetector.ts#L30-L36

        const isAppium = Boolean(
            // @ts-expect-error outdated jsonwp cap
            capabilities.automationName ||
            capabilities['appium:automationName'] ||
            capabilities.deviceName ||
            capabilities.appiumVersion
        )

    I solved my issue by using tap() instead of click() or checkOption() in web view.

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