Cannot start Appium with IOS real device Appium 1.5.3 - ios

It worked in the past. But recently I can't start Appium with iOS real devices anymore. My environment is as follow:
Appium 1.5.3
XCode 7.3
iOS 9.1
And I use selenium and io.appium as follow
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>4.0.0</version>
</dependency>
Whenever I start the test, I always get this exception when creating iOSDriver
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Removing com.project.classname failed (WARNING: The server did not provide any stacktrace information)
I googled that from iOS 10 and XCode 8 they don't support UI Automation. I still use iOS 9 and XCode 7. Does anyone have the same problem and any solutions. I am kind of stuck here. Thanks
This is log file from Appium
[debug] [iOS] Running ios real device reset flow
[debug] [iOS] Full reset requested. Will try to uninstall the app 'com.project.classname'.
[debug] [iOS] Creating iDevice object with udid 5571568ad437d17f705f6645d73ef78ea5e72e7b
[iOS] Could not remove 'com.project.classname' from device
[MJSONWP] Encountered internal error running command: Error: Removing com.project.classname failed
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/node_modules/node-idevice/main.js:145:6
at ChildProcess.exithandler (child_process.js:193:7)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:850:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Pipe._onclose (net.js:475:12)
[HTTP] <-- POST /wd/hub/session 500 973 ms - 175

Try to see if the problem is related to libimobiledevice or device lockdown
Use that command to install it:
brew install libimobiledevice --HEAD
also try to use this command
sudo chmod -R 777 /var/db/lockdown/

Related

Can I do Appium inspector connected simulator without error code 65

I had started a session between appium server and simulator(at xcode).
But xcodebuild failed with code 65
xcodebuild error message:
[debug] [W3C]
[debug] [W3C] at quitAndUninstall (/usr/local/Cellar/appium/1.22.3/libexec/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:588:15)
[debug] [W3C] at /usr/local/Cellar/appium/1.22.3/libexec/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:623:11
[debug] [W3C] at wrapped (/usr/local/Cellar/appium/1.22.3/libexec/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:60:13)
[debug] [W3C] at retry (/usr/local/Cellar/appium/1.22.3/libexec/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:43:13)
[debug] [W3C] at retryInterval (/usr/local/Cellar/appium/1.22.3/libexec/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:70:10)
[debug] [W3C] at /usr/local/Cellar/appium/1.22.3/libexec/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:603:7
[debug] [iOSSim] The simulator has '0' bundles which have 'WebDriverAgentRunner-Runner' as their 'CFBundleName':
[debug] [WebDriverAgent] No WDAs on the device.
I have kwnown that appium inspector connected with simulator does not need webAgentDriver. It isn't true?
In concolusion,
A simulator must need a WebDriverAgent? not for only a real device?
What is webDriverAgent? I think that it only let appium control iOS devices.
If using xcode 14 we need to have appium 2 and appium inspector installed to be able to access the app
Make sure you have node 16.16, if you don’t you can install nvm and use it to install multiple versions of node on the machine, you can fine NVM here
Install Appium 2 using: npm install -g appium#next
Once Appium is installed run appium -v to confirm that you have version > 2
Install XCUITest driver: appium driver install xcuitest
Install UIAutomator2: appium driver install uiautomator
Run appium driver list to confirm that both drivers are installed
Install Appium Inspector: can be downloaded here, download the latest version.

Error: Unable to find an active device after upgrade to Appium 1.5.3

I upgraded to Appium1.5 and now when I launch and try to run my tests I am seeing this error :
Checking my settings and all seems fine and even the inspector works fine .
[AndroidDriver] Error: Unable to find an active device or emulator with OS 1. The following are available: 192.168.99.101:5555 (4.3)
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at Object.callee$0$0$ (lib/android-helpers.js:154:16)
at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28
at flush (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
[Error: Unable to find an active device or emulator with OS 1. The following are available: 192.168.99.101:5555 (4.3)]
[MJSONWP] Encountered internal error running command: Error: Unable to find an active device or emulator with OS 1. The following are available: 192.168.99.101:5555 (4.3)
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at Object.callee$0$0$ (lib/android-helpers.js:154:16)
at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28
at flush (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
You need to specify the platform version as capability as following -
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1");
My version is 7.1, use the version which is right for you
1.If you want to work with appium version 1.5 again then you can do following things.
Uninstall appium and then install appium for specific version
npm uninstall -g appium
npm install -g appium#1.5
appium -v
2.Now suppose in case if you update appium version then you need to update then all maven dependencies,java,testng etc.
Suppose if you install latest appium then you need to check first your previos xcode,android and all dependencies works for it.
3.If upgrading the version not working then it could be problem with appium version so you have to revert back to your old version which was working fine as 1st option.
craj, may be it is the problem of the adb not of appium.
Had you tried adb devices on cmd?

iPhone automation using selenium webdriver,java,appium and webkit proxy: Not able to execute more than 1 testcase

I am working on iPhone automation using selenium webdriver, appium & ios webkit debug proxy.
Configurations:
OS X Version 10.11.2
Appium 1.3.5
Xcode: 7.2
Device: iPhone 6[9.2]
I have installed safariLauncher app in iPhone using Xcode.
Steps:
I launched appium through terminal.
Cmd: Appium &
Then launched ios-webkit-debug-proxy.
Cmd: ./bin/ios-webkit-debug-proxy-launcher.js -c [device udid]:27753 -d
I launch appium & webkit server every time before starting any test case execution.
Only the first test case works fine and 2nd test case onward run into below error in appium log:
code error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:389:31)
at null.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:308:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
info: <-- POST /wd/hub/session 500 153251.340 ms - 182
Please suggest any solution.

Titanium: App not being deployed to iOS simulator after iOS 9 upgrade

XCode decided to do an upgrade to iOS 9, and after that the app refuses to deploy to the emulator.
The build works ok, but it fails at this:
[INFO] : Invoking xcodebuild
[INFO] : Finished building the application in 40s 523ms
[INFO] : Launching iOS Simulator
[ERROR] : Project failed to build after 1m 21s 108ms
[ERROR] : An error occurred running the iOS Simulator (ios-sim exit code 1)
TRACE | titanium exited with exit code 1
ERROR | Error: ti run exited with error code 1
at ChildProcess.<anonymous> (/Users/stop/.appcelerator/install/5.0.1/package/node_modules/appc-cli-titanium/plugins/run.js:89:66)
at ChildProcess.emit (events.js:117:20)
at Process.ChildProcess._handle.onexit (child_process.js:810:12)
Any ideas?
There's no updates that i can install, it says everything is up to date.
I have SDK 5.1.0. installed
Ok, so i did 2 things here, not sure which one fixed it.
I ran appc setup and let it finish
I removed all the errors around the icons and images that were missing and were the wrong size.
After that it just started working. Not sure which of the 2 fixed it.

Iphone 5 Appium and jUnit - App did not have elements

I have a problem with my automated tests on iPhone 5. I could previously start test on iPad with iOS 6.1 but now I would like to do it on iPhone 5 iOS 8.1
In eclipse I got message A new session could not be created.
Log from appium:
error: Failed to start an Appium session, err was: Error: App did not have elements
info: [debug] Error: App did not have elements
at /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ ios.js:459:30
at Object.cb [as callback] (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios /ios-controller.js:247:7)
at next (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:801:43)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:32:16
at exports.respond (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/common.js:28:9)
at null.<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios.js:1449:18)
at getResultAndSendNext (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/lib/command-proxy.js:146:20)
at Socket.<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/lib/command-proxy.js:88:7)
at Socket.emit (events.js:117:20)
at _stream_readable.js:944:16
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: App did not have elements)","origValue":"App did not have elements"},"sessionId":null}
info: <-- POST /wd/hub/session 500 29025.843 ms - 172
capabilities:
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion", "8.1");
capabilities.setCapability("deviceName", "iPhone 5 iOS 8.1");
capabilities.setCapability("udid","104ce995950282f9dfaf371bf05ee6b00e7c0027);
Can anybody help me?
Beginning iOS 8, excessive amount of NSLog outputs can create deadlock in the internal communication of UIAutomation and Appium server. (read this article for more info Appium's Github page)
This causes such undesired outcomes.
A preventive workaround is described HERE: which solved the issue on my case. I hope it will help.

Resources