Skip to content

[🐛 Bug]: isDisplayed() and waitForClickable() throws error on iOS 15 and 16 #14316

@BryceLTaylor

Description

@BryceLTaylor

Have you 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

Metadata

Metadata

Assignees

Labels

Bug 🐛help wantedIssues that are free to take by anyone interested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions