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:
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 https://github.com/codeceptjs/CodeceptJS/issues/3414#issuecomment-2535275899
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?
@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 (https://github.com/webdriverio/webdriverio/pull/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.