Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to launch WDA without live internet connection after reboot #18378

Closed
AlienRullz opened this issue Mar 22, 2023 · 5 comments
Closed

Unable to launch WDA without live internet connection after reboot #18378

AlienRullz opened this issue Mar 22, 2023 · 5 comments
Labels
Needs Info typically non-actionable; needs author to respond

Comments

@AlienRullz
Copy link

The issue seen: Appium inspector fails to launch and throws below error:

'Failed to create session. 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: . 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.'

This only happens for a brand new session after device restart, or in cases where the USB link between iPhone and Mac is disconnected then reconnected and the iPhone has no internet connection.

The issue can be bypassed by having a live internet connection to the iPhone when starting the session. Once the inspector (or a actual python script) is successful, it will then work with or without a live internet connection until the device is rebooted or the USB reconnected.

Desired capabilities:
{
"platformName": "iOS",
"appium:udid": "phone udid",
"appium:automationName": "XCUITest",
"appium:deviceName": "iPhone"
}

iOS version = 16.3.1
xCode version = 12.3
MacOS = Ventura 13.2.1

I have tried every fix found online (AutoSigning enabled, Dev ID properly added to xCode, updated XCUITest driver, re-installed appium and xcode, tried xcode 13 release candidate from Apple Developer website).

Any help will be greatly appreciated!!

@mykola-mokhnach
Copy link
Collaborator

mykola-mokhnach commented Mar 22, 2023

Please provide the full server log with xcodebuild logging enabled. In general, we cannot do much if xcodebuild itself fails to compile/launch WDA.

@mykola-mokhnach mykola-mokhnach added the Needs Info typically non-actionable; needs author to respond label Mar 22, 2023
@AlienRullz
Copy link
Author

Please provide the full server log with xcodebuild logging enabled. In general, we cannot do much if xcodebuild itself fails to compile/launch WDA.

I'll come back to you with the logs, but you might be right, not sure there's something you can do your end other than suggest different way to set the session up. I setup xCode fully manually (no config file involved) and unless you think that could fix it, the more I think about, the more i dont think is something you guys can fix.

The issue seems to be with iOS 16 and the fact that without a live internet connection, the iPhone can't verify the trust of the developer so the WBA app can't launch. I'll come back with logs from both server and xcode.

@KazuCocoa
Copy link
Member

@AlienRullz
Copy link
Author

Fixed it @KazuCocoa , thanks for the link.
I guess for anyone hitting the same issue, as of iOS 16 you need a live connection to obtain code sign (Trusting the dev). If you're offline, it will not appear under VPN & Device manager and there's no way of actually trusting it.

In order to bypass you will need to have a Offline Provisioning Profile (as per the link above). The process, however, is not simple (unless is the 1st time setup in which case you're in luck).

  1. First, you will need the Development Certificate (this should already be present and added by xcode to the keyaccess and to the DevAccount on Apple)
  2. Create an iOS App Development provisioning profile - add all Certificate and all devices as you go through the setup (there's a tick box for all) - Most importantly, make sure you tick the 7day offline at the very bottom. Without that, it will not work
  3. Create an AdHoc Distribution Provisioning Certificate (same as above, however this doesn't have a offline requirement)
  4. Go to your Xcode and disable Automatically manage signing for WebLib, WebDriver and IntegrationApp
  5. Hit Product -> Clear build folder
  6. Xcode -> Settings -> Accounts and sign out
  7. Sign back in
  8. Enable Automatically manage signing for WebLib, WebDriver and IntegrationApp
  9. Go to your real device and uninstall any trace of apps installed by appium (for me I had the integration app and the Runner)
  10. Restart the phone
  11. Once phone is back up, go to xcode and run the build on the integration app. If it works, the Appium Inspector and any Appium scripts will work.

I have Appium 2.0, Appium Inspector, iOS 16.3.1, xCode 14.2 running on Ventura 13.2.1 and a iPhone 14 Pro (basically up to date everywhere).

There is a bit of a 'gotcha' tho. The offline provisioning profile is only valid for 7days. I emailed Apple to ask for an option with a longer validity so will have to wait on that and see if is possible. If not will need to refresh the profile every 7 days (which might not be ideal)

@KazuCocoa
Copy link
Member

Thanks for the detail. I'll update the XCUITest driver's troubleshooting to have a link for your comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Info typically non-actionable; needs author to respond
Projects
None yet
Development

No branches or pull requests

3 participants