webdriverio: [đ Bug]: isDisplayed() and waitForClickable() throws error on iOS 15 and 16
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.5.1 and later
Node.js Version
v22.11.0
Mode
Standalone Mode
Which capabilities are you using?
{
'appium:platformName': 'iOS',
'appium:platformVersion': iosVersion,
'appium:deviceName': 'iPhone Simulator',
'appium:udid': iosUDID,
'appium:automationName': 'XCUITest',
'appium:bundleId': `[redacted]`,
'appium:xcodeOrgId': '[redacted]',
'appium:showXcodeLog': true,
'appium:autoWebview': true,
'appium:autoAcceptAlerts': true,
'appium:app': pathToIOSApp,
}
or
{
platformName: 'iOS',
'appium:appiumVersion': '2.2.1',
'appium:app': lambdaTestURL,
'appium:device': 'iPhone.*',
'appium:platformVersion': 16,
'appium:automationName': 'XCUITest',
'appium:autoWebview': true,
'appium:isRealMobile': true,
'appium:deviceOrientation': 'PORTRAIT',
'appium:autoAcceptAlerts': true,
'lt:options': {
visual: true,
video: true,
build: buildName,
buildTags: tags,
},
}
What happened?
Issue presentation
When running the tests, if I first locate an element and then call isDisplayed() on it. Doing so takes a long time and results in an error in the console:
ERROR webdriver: WebDriverError: An unknown server-side error occurred while processing the command. Original error: elem.checkVisibility is not a function. (In âelem.checkVisibility(params)â, âelem.checkVisibilityâ is undefined) when running âexecute/syncâ with method âPOSTâ and args âfunction checkVisibility(elem, params) { return elem.checkVisibility(params); }â
The error itself doesnât cause the test to fail, but it is causing timeouts because of how long it takes to run. I console logged the time it took to run isDisplayed() and got around 10 seconds.
I see similar errors and time it takes when running [element].waitForClickable()
App setup
We are running a hybrid app using a webview with Android and iOS. We arenât seeing any issues with Android, only iOS version 15 and 16. We first saw it remotely using Lambdatest, but I can see it locally as well.
With the following packages installed in our package.json:
âappiumâ: â^2.13.1â, âappium-xcuitest-driverâ: â^7.33.0â âwebdriverioâ: â^9.5.1â
However, I updated all of the packages to their most recent packages and it didnât fix the issue.
âappiumâ: â^2.17.1â, âappium-xcuitest-driverâ: â^8.4.3â, âwebdriverioâ: â^9.12.0â
(appium-xcuitest-driver version 9 came out today and I havenât tested with it)
When it started
This issue started after running npm install with no changes to the package.json. The many patch updates created a diff that is too large to post here, but there were some appium sub-dependencies that had minor or patch version bumps. Iâm not sure if those are the cause, but Iâll list a couple of things I noticed:
@appium/base-driver bumped from 9.16.2 --> 9.16.4 @appium/base-plugin bumped from 2.3.3 --> 2.3.5 @appium/support bumpedfrom 6.0.6 --> 6.0.8
The rest of the diff is hundreds or thousands of lines, so I can provide more information if needed.
What is your expected behavior?
I expect isDisplayed() and waitForClickable() to execute quickly and not throw errors on all operating systems.
How to reproduce the bug.
import { test } from âvitestâ; import { getDriver } from â./lib/getWebdriverâ;
test(âshow isDisplayed() errorâ, async () => { const driver = await getDriver(âtestâ); const button = driver.$(â//button [@data-testid=ânextButtonâ]â); await button.isDisplayed(); });
// getDriver() calls remote(opts) based on OS and other factors. // this example uses vitest as a test runner. Getting an example without it was proving to be a lot of effort and I think this example that uses it should get the idea across. // the button is just an element available immediately after the webview loads the app
Relevant log output
ERROR webdriver: WebDriverError: An unknown server-side error occurred while processing the command. Original error: elem.checkVisibility is not a function. (In 'elem.checkVisibility(params)', 'elem.checkVisibility' is undefined) when running "execute/sync" with method "POST" and args "function checkVisibility(elem, params) {
return elem.checkVisibility(params);
}"
Code of Conduct
- I agree to follow this projectâs Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (12 by maintainers)
@BryceLTaylor
Sorry, I didnât have much time earlier to look into this. This delay is âannoyingâ, but is caused by Appium. As you debug the logs, you will see that it will call the
getAlertTextmultiple times. The Atom causes this to wait for a result. This triggers a timeout, which then automatically triggers the âfallbackâ to verify if there is an alert âblockingâ the webpage. This is done 3 times, which adds an extra delay of around 6 seconds, which is the ârootâ-cause of the long execution time.I need to dive into this to figure out why this is caused now (I know the reason which is the fallback đ ) and why I donât see this happening in my sessions
Hi @erwinheitzman
Itâs not falling back, secondly, see also this list. Safari is a pain with âmodernâ checks and there you see itâs supported as of iOS 17.4, before itâs broken