Automated testing on real IOS device fails because Appium inspector can't connect to the device. (Xcodebuild failed with code 65 & 66) - xcode

i have a problem with I was not able to get rid of for the past days.
My goal is to start an automated test, for an app that is already downloaded on the device, from my Mac on my iPhone.
I started with installing:
Node.js
Java JDK & JAVA_HOME variable
Appium & Appium inspector
Xcode & Xcode Command Line Tools
Appium driver (xcuitest & UIAutomation)
In the next step in entered my Desired Capabilities in the Appium inspector:
platformName : ios
appium:platformVersion : 16.1
appium:deviceName: iPhone 11 pro
appium:bundleId :
appium:automationName : XCUITest
appium:udid: <udid from my devic
appium:xCodeOrgId :
appium:xCodeSigningId : iPhone Developer
After entering these information I moved on and opened the WebDriverAgent.xcodeproj and signed in with my free Developer Account (Apple ID) and assigned a Team to WebDriverAgentLib, WebDriverAgentRunner, all Integrationtests and the IntegrationApp. The Firestone worked but the last three failed with the Error:
Failed to create provisioning Profile. The app ID "com.facebook.WebDriverAgentRuner" can not be registered to your development team. Change your bunde identifier to a unique String to try again.
and
No profiles for 'com.facebook.WebDriverAgentRunner' were found. Xcode couldn't find any iOS App Development provisioning profiles matching 'com.facebook.WebDriverAgentRunner'.
After reviewing the Problem I came up with following a few tutorials without any luck.
I tried to create a profiling Profile, but most ways I found were with the free version or just wouldn't work.
So i changed the bundle identifiers, even though it's not a beautiful solution and was able to trust the computer and install an app with Xcode.
But when I try to start a session with Appium inspector after I started the Appium server in Visual Studio Code it still fails with the Error:
In Appium inspector:
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.
In Visual Studio Code:
[debug] [XCUITestDriver#f4dc (e98a8edb)] Matched '/status' to command name 'getStatus'
[debug] [XCUITestDriver#f4dc (e98a8edb)] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [iProxy#00008030:8100] Connection was refused to port 8100
[XCUITestDriver#f4dc (e98a8edb)] socket hang up
[Xcode] xcodebuild exited with code '65' and signal 'null'
[debug] [XCUITestDriver#f4dc (e98a8edb)] Event 'wdaStartFailed' logged at 1674136358245 (14:52:38 GMT+0100 (Mitteleuropäische Normalzeit))
[debug] [XCUITestDriver#f4dc (e98a8edb)] Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
[debug] [XCUITestDriver#f4dc (e98a8edb)] xcodebuild error message:
[debug] [XCUITestDriver#f4dc (e98a8edb)] . 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.
[XCUITestDriver#f4dc (e98a8edb)] Quitting and uninstalling WebDriverAgent
[XCUITestDriver#f4dc (e98a8edb)] Shutting down sub-processes
[debug] [WebDriverAgent] Successfully reset '/Users/k.steffens/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj/project.pbxproj' with bundle id 'com.facebook.WebDriverAgentRunner'
[debug] [XCUITestDriver#f4dc (e98a8edb)] No WDAs on the device.
[XCUITestDriver#f4dc (e98a8edb)] {}
[DevCon Factory] Releasing connections for 00008030-0005298C0C45802E device on any port number
[DevCon Factory] Found cached connections to release: ["00008030-0005298C0C45802E:8100"]
[DevCon Factory] Releasing the listener for '00008030-0005298C0C45802E:8100'
[debug] [iProxy#00008030:8100] Closing the connection
[debug] [DevCon Factory] Cached connections count: 0
[debug] [XCUITestDriver#f4dc (e98a8edb)] Not clearing log files. U`clearSystemFiles` capability to turn on.
[iProxy#00008030:8100] The connection has been closed
[debug] [AppiumDriver#567d] Event 'newSessionStarted' logged at 1674136358629 (14:52:38 GMT+0100 (Mitteleuropäische Normalzeit))
[debug] [AppiumDriver#567d] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
[debug] [AppiumDriver#567d] xcodebuild error message:
[debug] [AppiumDriver#567d] . 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.
[debug] [AppiumDriver#567d] at quitAndUninstall (/Users/k.steffens/.appium/node_modules/appium-xcuitest-driver/lib/driver.js:584:15)
[debug] [AppiumDriver#567d] at /Users/k.steffens/.appium/node_modules/appium-xcuitest-driver/lib/driver.js:619:11
[debug] [AppiumDriver#567d] at wrapped (/Users/k.steffens/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:95:13)
[debug] [AppiumDriver#567d] at retry (/Users/k.steffens/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:68:13)
[debug] [AppiumDriver#567d] at retryInterval (/Users/k.steffens/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:105:10)
[debug] [AppiumDriver#567d] at /Users/k.steffens/.appium/node_modules/appium-xcuitest-driver/lib/driver.js:599:7
[HTTP] <-- POST /session 500 14443 ms - 1398
[HTTP]
After this try I even tried to add the bootstrapPath as a desired Capability and the agentPath as a desired Capability, with no luck.
But the error changed a little:
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 66 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.
Is there something I'm doing wrong, or is there better way to do automated testing on real iOS devices?
I would be very happy if you could help me out.
kind regards,
henry

Related

Xcode simulator no crash but real device problems

I run my app in Xcode through the simulator and it builds with no crashes. When I run on real device it successfully builds but I get crash errors. Someone suggested it might be the cordova screen lock but I tried it without and still have problems.
Running on real device: a blinking screen or it keeps reloading the first screen, never to make it to the next one. Please help!
Here are the different lines I am seeing when compared to the simulator:
Metal API Validation Enabled
<UMP SDK> To enable debug mode for this device, set: UMPDebugSettings.testDeviceIdentifiers = #[ #"___________________________________" ];
THREAD WARNING: ['CDVOrientation'] took '44.751953' ms. Plugin should use a background thread.
[Process] 0x10f003740 - [PID=1655] WebProcessProxy::didClose: (web process 0 crash)
[Process] 0x10f003740 - [PID=1655] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=4
[ProcessSuspension] 0x10e0042a0 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID 0 is invalid
[ProcessSuspension] 0x10e0042a0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=0, error: (null)
0x150842818 - [pageProxyID=13, webPageID=14, PID=1655] WebPageProxy::processDidTerminate: (pid 1655), reason 4
[assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
[ProcessSuspension] 0x10e004300 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=1655, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
[Loading] 0x150842818 - [pageProxyID=13, webPageID=14, PID=1655]
WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[XPC] Handle connection with error: Connection interrupted
[Process] 0x10f004110 - [PID=0] WebProcessProxy::didFinishLaunching: Invalid connection identifier (web process failed to launch)
[Process] 0x10f004110 - [PID=0] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=4
[Process] 0x150842818 - [pageProxyID=13, webPageID=14, PID=0] WebPageProxy::processDidTerminate: (pid 0), reason 4
[ServicesDaemonManager] interruptionHandler is called. -[FontServicesDaemonManager connection]_block_invoke
[Process] 0x10f0048f0 - [PID=1682] WebProcessProxy::didClose: (web process 0 crash)
[Process] 0x10f0048f0 - [PID=1682] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=4
THREAD WARNING: ['AdMob'] took '30.550049' ms. Plugin should use a background thread.
THREAD WARNING: ['Consent'] took '10.710205' ms. Plugin should use a background thread.
We saw this issue on Xcode 14.2 where web views were not loading.
Our WKWebViews had Content Rule List set.
The root cause was it compiled the Content Rule List to the underlying chipset (non-Intel), instead of respecting the Rosetta.
This issue was not seen when Xcode was launched without Rosetta.

Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65" Iphone6 Simulator

I am trying to run the Amazon app on an iPhone 6 simulator using Xcode.
The app is getting installed in the iPhone Simulator, but not able to interact with its elements.
Appium version - 1.7.2
Xcode Version 9.2
Platform Mac- 10.12.6
Downloaded the app - i.e. xxx.app.ipa
Logs:
[Xcode] 2018-02-13 21:23:08.009 xcodebuild[9868:75242] Error Domain=IDEFoundationErrorDomain Code=1 "Cannot launch simulated executable: no file found at /Applications/Xcode.app/Contents/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app" UserInfo={NSLocalizedDescription=Cannot launch simulated executable: no file found at /Applications/Xcode.app/Contents/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app} [Xcode] 2018-02-13 21:23:08.009 xcodebuild[9868:75242]
Error Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted} [Xcode] [Xcode] 2018-02-13 21:23:08.010 xcodebuild[9868:75259] Connection peer refused channel request for "dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface"; channel canceled
[Xcode] ** TEST EXECUTE FAILED ** [Xcode] [Xcode] 2018-02-13 21:23:08.011 xcodebuild[9868:75318] Error saving test log:
Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSFilePath=/Applications/Xcode.app/Contents/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Logs/Test/921A213D-B7E4-4994-9443-F73DDE5FBD4D.xcactivitylog, NSLocalizedDescription=No such file or directory} | User info: { [Xcode] NSFilePath = "/Applications/Xcode.app/Contents/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Logs/Test/921A213D-B7E4-4994-9443-F73DDE5FBD4D.xcactivitylog"; [Xcode] NSLocalizedDescription = "No such file or directory"; [Xcode] } [Xcode]
[XCUITest] xcodebuild exited with code '65' and signal 'null' [BaseDriver] Event 'wdaStartFailed' logged at 1518585788035 (21:23:08 GMT-0800 (PST)) [XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65". [XCUITest] Quitting and uninstalling WebDriverAgent, then retrying [XCUITest] Shutting down sub-processes [XCUITest] Removing WDA application from device [XCUITest] Error: Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65". at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:375:13) at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke as _invoke at GeneratorFunctionPrototype.prototype.(anonymous function) as next at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37) at Error: Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65". at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:375:13) at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke as _invoke at GeneratorFunctionPrototype.prototype.(anonymous function) as next at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37) at [XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on. [XCUITest] Killing running processes 'xcodebuild.B720A212-489B-4A48-BBDB-7119C9763406, B720A212-489B-4A48-BBDB-7119C9763406.*XCTRunner' for the device B720A212-489B-4A48-BBDB-7119C9763406... [XCUITest] 'pgrep -nif xcodebuild.*B720A212-489B-4A48-BBDB-7119C9763406' didn't detect any matching processes. Return code: 1 [XCUITest] 'pgrep -nif B720A212-489B-4A48-BBDB-7119C9763406.XCTRunner' didn't detect any matching processes. Return code: 1 [XCUITest] Deleting simulator created for this run (udid: 'B720A212-489B-4A48-BBDB-7119C9763406') [iOSLog] Stopping iOS log capture
It's saying it can't find the WebDriver app. Can you confirm its existence in /Applications/Xcode.app/Contents/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphonesimulator/?
If it doesn't exist, there is something wrong with your Appium install so I'd recommend reinstalling npm uninstall -g appium and npm install -g appium. Probably safe to do that anyway.
Also make sure you restart your device and uninstalling any existing WebDriver app on the device.
Error clear shows -- /Applications/Xcode.app/Contents/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app}
Webdriver agent need to be successfully running on device
Try to configure Webdriver agent and Developer ID ::
Open the existing the WebDriver Agent (double click on WebDriverAgent.xcodeproj)
On top of Xcode you File > New> File , then you will an pop up something like this
Select OSX->.Other-> Select Configuration settings file.
Paste the following things in newly created file.
DEVELOPMENT_TEAM = xxxxxxxxx
CODE_SIGN_IDENTITY = iPhone Developer
Development team is Team ID which your developer should be able to provide . Dont change the CODE_SIGN_IDENTITY.
In device.propoerties file add this
xcodeConfigFile=/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Config.xcconfig
In ConfigCapa.java file add this
capabilities.setCapability(“xcodeConfigFile”,emulatorProp.getProperty(“xcodeConfigFile”));
Open terminal go to
$ cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/
$ mkdir -p Resources/WebDriverAgent.bundle
sh ./Scripts/bootstrap.sh –d
Go to terminal type
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=DeviceID’ test Last line on build output above command should be Listening on USB. Then you are all set!
brew install libimobiledevice –HEAD
To run appium type appium &
To find version type appium — v

using security to importing CSSMERR_TP_CERT_EXPIRED secutity codesigning

Does anybody know why when I use 'security' on os x to import a valid identity that it seems to think it has expired:
There are 2 machines, my development machine and a jenkins slave.
I am using the xcodebuild to create an archive and then use:
xcodebuild -exportArchive -archivePath myApp.xcarchive -exportOptionsPlist exportOptions.plist -exportPath . PROVISIONING_PROFILE=fdd0caeb-58fb-41df-a5e8-e5e9bd1f95c9 "OTHER_CODE_SIGN_FLAGS=--keychain /Users/me/Library/Keychains/Buildsystem"
to build an ipa for the store. This works on my development machine using the same archive and the same exportOptions.plist but not on the jenkins slave. I get this error:
016-10-06 23:29:23.438 xcodebuild[87720:8494157] [MT] IDEDistribution:
-[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path
'/var/folders/yd/l_8k4cn91kjc9r853crzz98m0000gn/T/MyApp_2016-10-06_23-29-23.437.xcdistributionlogs'.
2016-10-06 23:29:23.888 xcodebuild[87720:8494157] [MT]
IDEDistribution: Step failed: : Error Domain=IDEDistributionErrorDomain Code=1 "The
operation couldn’t be completed. (IDEDistributionErrorDomain error
1.)"
error: exportArchive: The operation couldn’t be completed.
(IDEDistributionErrorDomain error 1.)
Error Domain=IDEDistributionErrorDomain Code=1 "The operation couldn’t
be completed. (IDEDistributionErrorDomain error 1.)"
** EXPORT FAILED **
I suspect it is because it thinks the code signing identity is bad. When I imported the identity as:
security import AP_Store.p12 -k /Users/me/Library/Keychains/Buildsystem -P ******* -T /usr/bin/codesign
then run:
security find-identity
I get:
1) 71497439A2987BC6830DF2E4879DBD3A5F1B2857 "iPhone Distribution:
xxxxx (xxxxxxxxx)" (CSSMERR_TP_CERT_EXPIRED)
If I import the same identity on my development machine it says it is OK.
Does anybody know why the same identity would be OK on one machine but not another?
This was caused by an expired intermediate certificate.
Apple Worldwide Developer Relations Certification Authority
had expired.
After replacing it everything worked.
A good reference is: MaintainingCertificates
Another thing that can lead to errors such as:
2016-10-11 11:41:11.780 xcodebuild[87463:15799133] [MT]
IDEDistribution: Step failed: : Error Domain=IDEDistributionErrorDomain Code=1
"(null)"
error: exportArchive: The operation couldn’t be completed.
(IDEDistributionErrorDomain error 1.)
is if you have an incorrect team ID in your exportOptions.plist file.

Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain

Running Instruments from the command line gave me this error:
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 8.) : Failed to launch process with bundle identifier
Any idea what the problem is and how to fix?
In my case I believe it was a provisioning profile issue. Try going into Product/Scheme/Edit Scheme and changing the Profile build configuration from Release to Debug or vice versa - that got it working for me.

libwebviewchromium.so error in my last (and first) android 4.4.4 build

I'm getting this error on my latest (and first) AOSPA build for lt01wifi.
It happens when I try to open Browser but it crashes before it opens.
Error Log:
I/LibraryLoader( 5999): Loading: webviewchromium
E/ActivityThread( 5999): Failed to find provider info for com.google.settings
E/dalvikvm( 5999): dlopen("/system/lib/libwebviewchromium.so") failed: dlopen failed: empty/missing DT_HASH in "libwebviewchromium.so" (built with --hash-style=gnu?)
E/WebViewFactory( 5999): error instantiating provider
E/WebViewFactory( 5999): java.lang.RuntimeException: Cannot load WebView
Probably it is the .so file itself that is the problem.
It was built with --hash-style=gnu, which is not supported in Android platform.
You should build your .so file again.
And this link could be helpful.

Resources