Search code examples
iosiphoneautomationappium-iosxcuitest

Appium inspector session is very slow (and hanging) when running a session on iOS real device


Scenario

I'm trying to run automated tests on an iOS real device, however, every time I start the Appium inspector session the client displays the app's loading page and never refreshes to update the inspector and display the home page.

Problem

When I manually press the refresh button on Appium the spinner gets displayed and takes a very long time to refresh the inspector. This happens on every interaction with the app.

Given

  • iOS real device: iPhone 12
  • iOS version: 15.1.1
  • Appium client: 1.15.0 and then tried 1.17.0

Capabilities Used

{ "platformName": "iOS", "platformVersion": "15.1.1", "deviceName": "iPhone 12", "automationName": "XCUITest", "autoAcceptAlerts": "true", "bundleId": "com.xxxxx.xxxxx", "xcodeOrgId": "xxxxxxxxxx", "xcodeSigningId": "iPhone Developer", "updatedWDABundleId": "com.facebook.WebDriverAgentRunner", "app": "/{path-to-ipaFile}/appFile.ipa", "udid": "xxxxxxxx-xxxxxxxxxxxxxxxx" }

WebDriverAgent

Please note that the WebDriverAgent app is trusted (General -> VPN & Device Management).

You can find the logs here.

Appium Server Logs

You can find the logs here.

Failed Attempts for a Solution

  • Add to the capabilities "simpleIsVisibleCheck": "true" and "useJSONSource": "true"
  • Add to t he capabilities usePrebuiltWDA=true and derivedDataPath=/Users/myUserName/Library/Developer/Xcode/DerivedData/WebDriverAgent-
ciegwgvxzxdrqthilmrmczmqvrgu/
  • Run Appium server from CLI instead of Appium client

Unfortunately, none of the attempts worked.

NOTE: The same problem is occurring on simulator.

enter image description here


Solution

  • Turned out the getSession() function in Appium was taking too long to get a response due to a large table list, when I removed the items from the list Appium was fast again and getSession() was not taking a long time to get a response.