Device farm (iOS) run failure - Unable to start WebDriverAgent session because of xcodebuild failure

0

Our device farm runs just suddenly stopped working overnight since Aug 25 (thursday) (Without us changing any line of code in our automation project / anywhere else) Before this date all our runs were working, and since that we get errors for iOS only.

Any help would be welcome if something change and we should align our tests or it's an amazon DF issue

This is the errormessage we get: ( I replaced the name of our app here)

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Unable to start WebDriverAgent session because of xcodebuild failure: A new session could not be created. Details: Cannot launch io.{replaced_app_name} application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device. 

Since we did not change any code and it broke overnight it feels to me that it's not an issue on our side, however i cant even find a way how to check or verify this. (Of course locally it works) However this part of the logs seems fishy as it does not really contain any capabilities besides iOS:

Host info: host: 'ip-192-168-11-5.us-west-2.compute.internal', ip: 'fe80:0:0:0:87f:fbd3:cc7d:7555%en0'
Build info: version: '4.8.3', revision: 'e5e76298c3'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '12.0.2'
Driver info: io.appium.java_client.ios.IOSDriver
Command: [null, newSession {capabilities=[{platformName=IOS}], desiredCapabilities=Capabilities {platformName: IOS}}]
Capabilities {platformName: IOS}

We use Appium 2 and our testpec file for appium should already have the referenes for the capabilities The appium server also starts succesfully

phases:
  install:
    commands:
      - export NVM_DIR=$HOME/.nvm
      - . $NVM_DIR/nvm.sh
      - nvm install --lts

      - npm i -g appium@2.0.0-beta.71
      - appium -v
      - appium driver install xcuitest
  pre_test:
    commands:
      - echo "Start appium server"
      - >-
        appium --log-timestamp
        --default-capabilities "{\"appium:usePrebuiltWDA\": true, \"appium:derivedDataPath\":\"$DEVICEFARM_WDA_DERIVED_DATA_PATH\",
        \"appium:deviceName\": \"$DEVICEFARM_DEVICE_NAME\", \"platformName\":\"$DEVICEFARM_DEVICE_PLATFORM_NAME\", \"appium:app\":\"$DEVICEFARM_APP_PATH\",
        \"appium:automationName\":\"XCUITest\", \"appium:udid\":\"$DEVICEFARM_DEVICE_UDID_FOR_APPIUM\", \"appium:platformVersion\":\"$DEVICEFARM_DEVICE_OS_VERSION\",
        \"appium:language\":\"en\"}"
        >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &

Update: After changing the predefined appium version, to the latest that was release 5 days ago (2.1.3) We experience the same issue

So far the only diff I found between the working/not working run logs is this line: The working one installed this version of xcutest:

Driver xcuitest@4.34.1 successfully installed

While the failing one has a higher version:

Driver xcuitest@4.35.0 successfully installed

Found a way to install specifix XCUITest driver via:

appium driver install xcuitest@4.34.1

After adding this command, we still see same xcodebuild failure

Other things I tried so far: Also tried to turn off the usePrebuiltWDA capability to false and make it build it's own that gives xcodebuild failure 65 as well (which is the config you should do locally for your webdriver )

When tried the useNewWDA capability then it runs into an error too

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
xcodebuild error message:

2023-08-28 05:57:30.393 xcodebuild[1822:6499]  DVTDownloadable: Unexpected error attempting to parse downloadable from index: Error Domain=DVTDownloadableErrors Code=16 "Unable to read in downloadable data. See underlying errors for details."
Janos
質問済み 1年前794ビュー
2回答
0
承認された回答

So far nothing I tried have worked, But it seems that I found a workaround...

If I change the iOS device from the device pool to a different one, then there the tests are working again ( hence it could build the webdriverAgent against that new device )

Perhaps an original solution would be a proper way to delete and rebuild the WebdriverAgent on DF side once this happens ( I just could not find a solution that would work and do this).

For context, I've used an iPhone 13 with iOS 16.0.2 where this issue appeared, and changed to an iOS 16.6 device. Tests are green again

As an update: Since then a lot changed on device farm, and now there is a proper way to use appium2, and there are new prebuild wda-s that we can use https://repost.aws/questions/QUIoP8rRhzTCyYJx2ro9qEOg/device-farm-ios-run-failure-unable-to-start-webdriveragent-session-because-of-xcodebuild-failure#CO8SqU-srXQ02nfBHmQpd5JQ

Janos
回答済み 1年前
0

I'm experiencing the same problem with AWS Device Farm. Did you ever resolve this? I've selected an iOS 16.6 device, but getting:

2024-09-03 11:15:07:260 - [AppiumDriver@011a] Encountered internal error running command: Error: Could not find a driver for automationName 'XCUITest' and platformName 'iOS'. Have you installed a driver that supports those capabilities? Run 'appium driver list --installed' to see. (Lower-level error: Could not find installed driver to support given caps)

Added appium driver list --json to the script, output is appium driver list --json { "xcuitest": { "pkgName": "appium-xcuitest-driver", "version": "5.8.1", "installType": "npm", "installSpec": "xcuitest@5.8.1", "installPath": "/Users/device-farm/.appium/node_modules/appium-xcuitest-driver", "appiumVersion": "^2.0.0", "automationName": "XCUITest", "platformNames": [ "iOS", "tvOS" ], "mainClass": "XCUITestDriver", "scripts": { "build-wda": "./scripts/build-wda.js", "open-wda": "./scripts/open-wda.js" }, "schema": { "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "properties": { "webdriveragent-port": { "appiumCliDest": "wdaLocalPort", "default": 8100, "description": "Local port used for communication with WebDriverAgent", "maximum": 65535, "minimum": 1, "type": "integer" } }, "additionalProperties": false, "title": "XCUITest Driver Configuration", "description": "Appium configuration schema for the XCUITest driver.", "$id": "driver-xcuitest.json" }, "installed": true }, "uiautomator2": { "pkgName": "appium-uiautomator2-driver", "installed": false }, "mac2": { "pkgName": "appium-mac2-driver", "installed": false }, "espresso": { "pkgName": "appium-espresso-driver", "installed": false }, "safari": { "pkgName": "appium-safari-driver", "installed": false }, "gecko": { "pkgName": "appium-geckodriver", "installed": false }, "chromium": { "pkgName": "appium-chromium-driver", "installed": false } }

so this seems ok. However, looking at the appium logs, I see: 2024-09-03 11:14:47:544 - [Appium] Welcome to Appium v2.2.1 2024-09-03 11:14:47:545 - [Appium] Non-default server args: 2024-09-03 11:14:47:546 - [Appium] { basePath: '/wd/hub', 2024-09-03 11:14:47:546 - [Appium] logNoColors: true, 2024-09-03 11:14:47:546 - [Appium] logTimestamp: true, 2024-09-03 11:14:47:546 - [Appium] relaxedSecurityEnabled: true } 2024-09-03 11:14:47:546 - [Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities: 2024-09-03 11:14:47:547 - [Appium] { 'appium:deviceName': '00008120-000C61642610A01E', 2024-09-03 11:14:47:547 - [Appium] platformName: 'iOS', 2024-09-03 11:14:47:547 - [Appium] 'appium:app': '/tmp/devicefarm-workspace/execution-mk4ws5i1/uploads-kodgdeke/app-snvkwwic.ipa', 2024-09-03 11:14:47:547 - [Appium] 'appium:udid': '00008120-000C61642610A01E', 2024-09-03 11:14:47:547 - [Appium] 'appium:platformVersion': '17.4', 2024-09-03 11:14:47:547 - [Appium] 'appium:derivedDataPath': 2024-09-03 11:14:47:547 - [Appium] '/tmp/devicefarm-workspace/execution-mk4ws5i1/shared-xfa5ffli/DerviedDataesix5k7a', 2024-09-03 11:14:47:547 - [Appium] 'appium:usePrebuiltWDA': true, 2024-09-03 11:14:47:547 - [Appium] 'appium:automationName': 'XCUITest' } 2024-09-03 11:14:47:560 - [Appium] Appium REST http interface listener started on http://0.0.0.0:4723/wd/hub 2024-09-03 11:14:47:560 - [Appium] You can provide the following URLs in your client code to connect to this server: 2024-09-03 11:14:47:560 - [Appium] http://127.0.0.1:4723/wd/hub (only accessible from the same host) 2024-09-03 11:14:47:560 - [Appium] http://192.168.64.2:4723/wd/hub 2024-09-03 11:14:47:560 - [Appium] No drivers have been installed in /private/tmp/devicefarm-workspace/execution-mk4ws5i1/test-package-xxtgkjxe. Use the "appium driver" command to install the one(s) you want to use. 2024-09-03 11:14:47:560 - [Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.

So it seems that when appium executes, it cannot find any drivers or plugins?

回答済み 5日前
  • Phew... This was an old post, it's certainly got resolved. but I dont remember the actual contexts ( and ofc it's my bad that i did not write an answer for future people)

    Although a lot of time passed since, so i would encourage you to re-read the setup documentation because now you are not needed to install appium yourself.

    This is how you use a pre installed appium ( 2.2.1) - export NVM_DIR=$HOME/.nvm - . $NVM_DIR/nvm.sh

      - nvm use 16
      - node --version
    
      # Use appium 2.2.1 as a pre installed version in device farm
      - avm 2.2.1
      - appium --version
    

    Also double check your derived data path. it's not ( to my latest knowledge, and what i use) is: DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V8;

    and lastly.. when you start the appium server forget the /wd/hub i think it's faulty in the setup docs. if I have /wd/hub in it, then it fails to start and find it, but if I skip it, then it works: http://0.0.0.0:4723/status

    So I think if you check this 3 thing you should be able to solve your problem too

  • Thanks Janos,

    After trying multiple tweaks, I changed:

    avm 2.2.1

    to be a direct npm install

    npm -g appium@2.2.1

    After doing this, the error got past not finding the XCUITest driver.

    The issue I'm facing now is that it does launch my app on the device, but fails to find an element on the app. Scripts work against Android, but not iOS.

    I need to now prove out that the tests work on a local physical device to ensure that there isn't an issue with my test script.

    Thanks for your help.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ