MilaLynx
MilaLynx

Reputation: 11

Appium + Xcuitest doesn't recognize iOS native elements after upgrades

Upgraded iOS device from 15.6 to 18, Xcode to 16, Appium from 2.0.1 to 2.11.5 and xcuitest from 4.12.0 to 7.27.0. After those upgrades Appium Inspector shows only the specified app bundle but no native parts.

This is how the view looked in Appium Inspector before upgrades and Call.../Cancel buttons were accessible: screenshot

This is how it looks after upgrades and those buttons are not accessible via Appium Inspector anymore: screenshot

Seems, that somewhere is some setting, that should be enabled or so, but I cannot get, where and what it is.

Tried to re-install Appium and xcuitestdriver, but nothing helped.

Upvotes: 0

Views: 433

Answers (3)

KILLtheWEEZEL
KILLtheWEEZEL

Reputation: 268

This is expected default behavior since XCUITest Driver 6.

I referenced the appium wiki and this solution worked for me. https://appium.github.io/appium-xcuitest-driver/latest/guides/troubleshooting/#interact-with-dialogs-managed-by-comapplespringboard

Start a session without appium:app nor appium:bundleId

I removed the the following lines from my iOS driver setup

IOSOptions.setApp("myAPP.ipa");
IOSOptions.setBundleId("com.foo");

This tells appium that it will need to detect the foreground app and provide the source rather than assuming the source is always my app under test.

Then you will need to take ownership of installing and activating your app on your own when creating the driver by adding these lines right after creating your iOSDriver.

driver.executeScript("mobile: installApp", Map.of("app", "myAPP.ipa"));
driver.executeScript("mobile: activateApp", Map.of("bundleId", "com.foo"));
driver.setSetting("respectSystemAlerts", true); // Not sure if still needed?

Edit Explanation:

I initially recommended only adding this line

driver.setSetting("respectSystemAlerts", true);

This initially helped my team handle all of the system dialogs and permissions but failed to work on the notification page. After doing the above steps all pages that we have tested seem to work.

Upvotes: 0

Mayank Gaurav
Mayank Gaurav

Reputation: 1

Try this (No need to Downgrade any Updates):

  1. Set 'snapshotMaxDepth' in DesiredCapabilities

    "appium:settings[snapshotMaxDepth]": 500 Screenshot

  2. In Appium Inspector toggle on 'Show Element handles' Screenshot

** Also update XCUITest Driver

Upvotes: 0

Nelson Mosquera
Nelson Mosquera

Reputation: 1

The fix I found was:

  1. Deleting iOS 18.0 from Xcode.
  2. Went back to Xcode v15.4 with iOS 17.5 (If you get Xcode form the App Store it will automatically update so you should get that specific version it directly from the apple developer site)
  3. Installing the appium driver for XCUITest 5.16.

After that Appium started recognizing native iOS elements for me.

Upvotes: 0

Related Questions