Search code examples
appiumtvos

Build and launch 'WebDriverAgentRunner_tvOS' for deployment target-Apple TV(v13.3) through code


I'm new to appium with tvOS. I'm using appium 1.16.0 desktop version. When I build the WebDriverAgentRunner_tvOS(from XCODE) with the desired settings, proper scheme and destination and proper code signing identity it builds fine. Launching appium later and starting the appium inspector with the desired caps(mentioned below) successfully installs the WDA on the target device and launches the app. If I try the same thing from my java code by trying to launch appium from main.js(Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js), I'm getting the below error.

Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 70

APPIUM CAPS(for Simulator. Same happens for real device): { "app": "com.xxxx.xxxx-xx", "platformName": "tvOS", "platformVersion": "13.3", "deviceName": "Apple TV", "realDevice": false, "udid": "FEF50073-E986-4332-8E0B-6434D9AD8A11", "xcodeOrgId": "XXXXXXXXXX", "xcodeSigningId": "Apple Developer", "useNewWDA": true }

Environment: macOS catalina(10.15.1) XCODE v11.3 Appium v1.16.0 tvOS v13.3

NOTE: From the logs it looks like WDAgentRunner is trying to build for a different target when launching appium from main.js(via code); works fine when launching appium inspector for the same appium.app with the same desired caps. logs below.

    [Xcode] 
[Xcode]     IDEDerivedDataPathOverride = /Users/debajyoti.bose/Library/Developer/Xcode/DerivedData/WebDriverAgent-bftxdyupbfulprcrdichuqzzkdsz
[Xcode] 
[Xcode] Build settings from command line:
[Xcode]     COMPILER_INDEX_STORE_ENABLE = NO
[Xcode]     GCC_TREAT_WARNINGS_AS_ERRORS = 0
[Xcode]     IPHONEOS_DEPLOYMENT_TARGET = 13.3
[Xcode] 
[Xcode] 
[WD Proxy] Got an unexpected response with status undefined: {"errno":-61,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8100}
[Xcode] xcodebuild: error: Unable to find a destination matching the provided destination specifier:
[Xcode]         { id:FEF50073-E986-4332-8E0B-6434D9AD8A11 }
[Xcode] 
[Xcode]     Available destinations for the "WebDriverAgentRunner" scheme:
[Xcode]         { platform:macOS, arch:x86_64, variant:Mac Catalyst, id:1711F5AF-1EA1-58EC-9543-6E9E6BA75B19 }
[Xcode]         { platform:iOS Simulator, id:D185E9C1-0F68-4771-8971-CAB2CE2D73A1, OS:13.3, name:iPad (7th generation) }
[Xcode]         { platform:iOS Simulator, id:FD2C3C04-ABA2-4514-A45A-39E52B0A0BAA, OS:13.3, name:iPad Air (3rd generation) }
[Xcode]         { platform:iOS Simulator, id:B142E5F1-2354-49C2-8CFD-1066DC254C1A, OS:13.3, name:iPad Pro (9.7-inch) }
[Xcode]         { platform:iOS Simulator, id:3730F0AE-0526-4500-B8C3-4317B93D5822, OS:13.3, name:iPad Pro (11-inch) }
[Xcode]         { platform:iOS Simulator, id:65014AAE-309E-4A06-895A-DB4BA4DE3D74, OS:13.3, name:iPad Pro (12.9-inch) (3rd generation) }
[Xcode]         { platform:iOS Simulator, id:870EBC55-8E7D-4D6A-8239-8DC9E64F5558, OS:13.3, name:iPhone 8 }
[Xcode]         { platform:iOS Simulator, id:0D1CA5E4-7710-4ED7-8490-D0A0D23ADB3F, OS:13.3, name:iPhone 8 Plus }
[Xcode]         { platform:iOS Simulator, id:A5DF86A7-3425-4EB6-86C3-37F124954374, OS:13.3, name:iPhone 11 }
[Xcode]         { platform:iOS Simulator, id:FF3AB897-7B93-4901-8362-C4FA727A2631, OS:13.3, name:iPhone 11 Pro }
[Xcode]         { platform:iOS Simulator, id:61F93B37-2BC9-4C87-8DE1-1CB096460B50, OS:13.3, name:iPhone 11 Pro Max }
[Xcode] 
[Xcode]     Ineligible destinations for the "WebDriverAgentRunner" scheme:
[Xcode]         { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
[Xcode]         { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }
[Xcode] 
[XCUITest] xcodebuild exited with code '70' and signal 'null'

Solution

  • Figured it out. was initialising IOSDriver. Had to use AppiumDriver instead.IOSDriver defaults to iPhone platform even though, 'platformName' capability is defined as tvOS. Got confused as there is no specific tvOS driver available in appium. Although using iOS driver also works fine if WDARunner is separately installed. Appium inspector(Desktop UI) knows it as the driver is not initialised explicitly there