Device Farm: Appium iOS test never launches app, WebdriverAgent shows error "Failed to get automation session"


Problem: my tests are not running and eventually get terminated. While I see both the app and WDA getting installed in the video, the app will never get launched.

Testspec output does not reveal any meaningful info, only shows "Terminated: 15". Reviewing the syslog output, I'm able to see a couple of issues with WDA:

WebDriverAgentRunner-Runner(WebDriverAgentLib)[416] <Notice>: Enqueue Failure: Application '' has not loaded accessibility /Users/saaandr/Downloads/WebDriverAgent-2.20.8/WebDriverAgentRunner/UITestingUITests.m 38 1


WebDriverAgentRunner-Runner(WebDriverAgentLib)[416] <Notice>: Enqueue Failure: Failed to get automation session for Timed out while requesting automation session for (pid:0)

ARN run: arn:aws:devicefarm:us-west-2:223051165180:run:c248fb2e-1df2-4c2c-8499-5bf7523ce683/4e9ab72e-c9d7-4081-ad7d-9341c4d10eb2

As far as desired capabilities, I am not modifying anything from the default capabilities. Also, the testspec yml uses the latest testspec for iOS (v 7.0) as a starting point, modified only with a custom py.test command.

This is the behavior that I see when I choose to run test on an iOS14.0, or 13.3.1 device. Executing the xcodebuild -version command in the install phase of the testspec shows that it is running Xcode 11.7, which was released back in Sept 2020. The test run eventually gets terminated by the WebDriverAgentRunner not being able to find the app running.

But when I attempt to run on a device with iOS14.8 or 15.x, the setup fails within 2 minutes, since the app cannot be installed due to a resigning issue, similar to this post.

Worth mentioning, this same test runs with no problems on an Android device. Any help is appreciated.

asked 2 years ago807 views
1 Answer

Hi There,

Thanks for reaching out through re:Post!

Based on the data you have provided, it doesn't seem that the issue is with Appium or the Device ( I double checked there was no issues with the device you used, The TearDown suit completed successfully after executing the test ). The App being installed means Appium already started the session, but seems the failure was caused by the App failing to launch. I am inclined that error "has not loaded accessibility" could be the reason for the session to time out.

I am suspecting either the app to be having an issue ( problem launching on a the device OS ) or that Xcode is actually having a bug.

  • Can you please test the same app on a remote session and see if you can launch it with no problems ?
  • If it launch with no issues, please could you check with a different Appium version ( We select a different version of Xcode and WDA based on the Appium version selected ), I would recommend "Appium version 1.16.0 or 1.17.1" for iOS devices running 13.3.1 and 1.18.0 for devices running OS14.
  • Could you please confirm if your App runs fine locally on the same Appium/ Physical Device configuration ?
answered 2 years ago
  • Hello Wassim, Thanks for following up on my post. I certainly tried the same build on different iOS versions as well via Remote Session. Here are the arn urls for these attempts:

    iOS14 on iPhone XR: arn:aws:devicefarm:us-west-2:223051165180:session:78ecb244-3ae4-4676-9491-87a864f87307/2c9a8783-ea97-47b4-9c0b-f056de1409fb/00000 On this run I never saw the app icon appear on the screen and I never saw the splashcreen show up.

    iOS 13.1.3 iPhone 11: arn:aws:devicefarm:us-west-2:223051165180:session:78ecb244-3ae4-4676-9491-87a864f87307/b4508423-862b-47c0-89b4-ad01bf4a5bc2/00000 On this run the app gets installed and you'll see the app launched for a second. Looks like it crashes immediately after at the 1:36 mark in the video.

    iOS 15.02 on iPhone 12 Pro: arn:aws:devicefarm:us-west-2:223051165180:session:78ecb244-3ae4-4676-9491-87a864f87307/ef24c59a-cb2b-459d-abcf-36362fb12048/00000 The app never launched on this attempt.

    iOS 13.1.3 on iPhone 11 Pro: arn:aws:devicefarm:us-west-2:223051165180:session:78ecb244-3ae4-4676-9491-87a864f87307/9ae5f68e-246c-4193-809a-855bffea07d8/00000 You'll see the app is installed, but it seems to crash at 1:14 in the video.

    Tried two different .ipa files, both signed for app store distribution.

  • Regarding your question of testing a different version of appium via the testspec file, I will try that next.

    I can confirm that the same test runs locally on a physical device. The difference is that in the local environment, I am specifying the .app build within the DerivedData directory. Locally, I've been using Appium 1.20 and 1.19.1.

    Is there any guidance in how to sign the .ipa files that get uploaded for automated device farm sessions? Should it be Adhoc vs. App Store?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions