Having problems in running Appium app for automation mobile app testing
Following tool versions I'm using
Appium version: 1.2.1
Xcode: 5.1.1
Following are the steps which I’m doing,
Download Appium.dmg
Run dmg file and then launched appium.app file
Build application for 7.1 simulator from Xcode
On appium.app, enabled ‘App Path’ option and provided .app file path “/Users/umairrashid/Library/Application Support/iPhone Simulator/7.1/Applications/878133B5-7078-4E92-B3A2-607A3A3C2AC3/Recipes.app”
In ‘General Settings’,
Server Address: 127.0.0.1, Port: 4723
Check for Updates: Enabled
New Command Timeout: 7200s
When I click ‘Launch’ button then everything seems to be okay.
When I click ‘Inspector’ button then following errors displayed,
Could Not Launch Appium Inspector
Could not start a new session
Be sure the Appium server is running with an application opened by using the "App Path" parameter in Appium.app (along with package and activity for Android) or by connecting with selenium client and supplying this in the desired capabilities object.
In Appium Console, I got following error,
2014-08-21T17:57:57.789Z - info: --> POST /wd/hub/session {"desiredCapabilities":{"platformName":"iOS","platformVersion":"7.1","newCommandTimeout":"999999","automationName":"Appium"}}
2014-08-21T17:57:57.792Z - info: <-- POST /wd/hub/session 500 3.235 ms - 286
2014-08-21T17:57:57.772Z - debug: Request received with params: {}
2014-08-21T17:57:57.772Z - debug: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
2014-08-21T17:57:57.775Z - debug: Appium request initiated at /wd/hub/sessions
2014-08-21T17:57:57.775Z - debug: Request received with params: {}
2014-08-21T17:57:57.775Z - debug: Responding to client with success: {"status":0,"value":[]}
2014-08-21T17:57:57.789Z - debug: Appium request initiated at /wd/hub/session
2014-08-21T17:57:57.789Z - debug: Request received with params: {"desiredCapabilities":{"platformName":"iOS","platformVersion":"7.1","newCommandTimeout":"999999","automationName":"Appium"}}
2014-08-21T17:57:57.790Z - error: The following desired capabilities are required, but were not provided: deviceName
2014-08-21T17:57:57.790Z - debug: Got configuration error, not starting session
2014-08-21T17:57:57.791Z - debug: Cleaning up appium session
2014-08-21T17:57:57.791Z - error: Failed to start an Appium session, err was: Error: The following desired capabilities are required, but were not provided: deviceName
2014-08-21T17:57:57.791Z - debug: Error: The following desired capabilities are required, but were not provided: deviceName
at Capabilities.checkValidity (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/lib/server/capabilities.js:120:13)
at Appium.configure (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/lib/appium.js:256:35)
at Appium.start (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/lib/appium.js:100:10)
at Object.exports.createSession [as handle] (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/lib/server/controller.js:159:16)
at next_layer (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/route.js:103:13)
at Route.dispatch (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/route.js:107:5)
at /Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:213:24
at Function.proto.process_params (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:286:12)
at next (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:207:19)
at next (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:182:38)
2014-08-21T17:57:57.791Z - debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: deviceName)","origValue":"The following desired capabilities are required, but were not provided: deviceName"},"sessionId":null}
2014-08-21T17:58:08.130Z - info: --> GET /wd/hub/status {}
—————————————————
When Launching with ‘Prelaunch Application’:Enabled, got following errors
2014-08-21T18:00:55.417Z - debug: Attempting to retry launching instruments, this is retry #3
2014-08-21T18:00:55.418Z - debug: Killall iPhoneSimulator
2014-08-21T18:01:00.420Z - info: Launching instruments
2014-08-21T18:01:00.421Z - debug: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 7.1
2014-08-21T18:01:00.422Z - debug: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iPhone Retina (4-inch) - Simulator - iOS 7.1 /Users/umairrashid/Library/Application Support/iPhone Simulator/7.1/Applications/878133B5-7078-4E92-B3A2-607A3A3C2AC3/Recipes.app -e UIASCRIPT /Users/umairrashid/Library/Application Support/appium/bootstrap/bootstrap-7a459bb511e03f3b.js -e UIARESULTSPATH /tmp/appium-instruments
2014-08-21T18:01:00.422Z - debug: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}
2014-08-21T18:01:00.422Z - debug: And launch timeouts (in ms): {"global":90000}
2014-08-21T18:01:01.415Z - debug: [INST STDERR] Instruments Usage Error : Could not remove existing output document 'file:///Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/instrumentscli0.trace': Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “instrumentscli0.trace” because the volume “Appium” is read only." UserInfo=0x7fac5e2d6100 {NSFilePath=/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/instrumentscli0.trace, NSUnderlyingError=0x7fac5d92d760 "The operation couldn’t be completed. Read-only file system"}.
2014-08-21T18:01:01.483Z - debug: [INSTSERVER] Instruments exited with code 254
2014-08-21T18:01:01.483Z - debug: Killall instruments
2014-08-21T18:01:01.486Z - debug: Instruments crashed on startup
Here I'm expecting that when I click Inspect button from Appium then Simulator is launched and I can see XPaths etc in that view.
Are you sure you have the icon of apple selected(Sometimes we do silly misclicks)
If you have have "force device" checked please uncheck it.
If you still have problems it would be better for you to take screenshots of your appium gui and post it here so I can help in a more through way
Are you sure that you have installed Appium by dragging Appium.app to your apps folder?
The below error message suggests that you are just launching it from the DMG file.
Instruments Usage Error : Could not remove existing output document 'file:///Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/instrumentscli0.trace'
Related
I'm trying to run an iOS app with appium i've searched several examples on internet and this is with what i've come out :
public class NotAScenario {
IOSDriver driver;
#BeforeTest
public void start() throws InterruptedException, MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platformName", "iOS");
caps.setCapability("platformVersion", "9.3");
caps.setCapability("deviceName", "mydevicename");
caps.setCapability("app", "myipafile.ipa");
driver = new IOSDriver(new URL("http://127.0.0.0:4723/wd/hub"), caps);
sleep(5000);
}
#AfterTest
public void end() throws InterruptedException {
sleep(5000);
driver.quit();
}
#Test
public void test() throws InterruptedException {
System.out.println("test");
sleep(5000);
}
}
I tried with an real device iphone 5S, I tried with a simulator same result the app just open/close in 0.5 sec in a loop then it crashes and I get this error
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [Instruments] Attempting to launch instruments, this is try #1
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID 'myudid'
[debug] [Instruments] Found Insruments-Without-Delay: /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/sw/w9bk_9_96s1bwz15mzxk3qpd7lj5f9/T/appium-instruments/instrumentscli0.trace -w myudid my.app.package -e UIASCRIPT "/Users/mobileautomation/Library/Application Support/appium/bootstrap/bootstrap-bbff984e2d53a4ae.js" -e UIARESULTSPATH /var/folders/sw/w9bk_9_96s1bwz15mzxk3qpd7lj5f9/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[HTTP] <-- GET /wd/hub/status - - ms - -
[HTTP] <-- GET /wd/hub/status - - ms - -
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [Instruments] [INST STDERR] Instruments Trace Error : Target failed to run: Permission to debug my.app.package was denied. The app must be signed with a development identity (e.g. iOS Developer).
[debug] [Instruments] Instruments exited with code 253
[Instruments] Error launching instruments: Instruments crashed on startup
I've tried to run it from my code, I tried to run it directly from appium and I even tried to run it from Instruments/Automation but I keep on having the same result the :
[INST STDERR] Instruments Trace Error : Target failed to run: Permission to debug my.app.package was denied. The app must be signed with a development identity (e.g. iOS Developer).
I've seen in here that it can be related to the fact that the build is in "Release" and not in "Debug" so I asked the dev team to give me a debug build but I still have the same result.
Could it be that they didn't build it the right way ?
Am I missing something ? Do they need the device name / udid in an allowed file or something ?
EDIT :
I did receive a new build of the dev it was indeed an issue with the provisionning profile that was not in dev & the build settings not in debug
Please use debug build of the app , this problem is due to not using debug build ,you need debug build on iOS in order to automate and make sure ui automation is enabled in developer options
Go to below folder
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform"
I found a folder named (11.2) & My real device version was (11.2.5)
Just Renamed the folder with version name (11.2) -> (11.2.5).
Started working again from me.
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.
When Appium tries to run application, the screen flashes with app splash screen, as if Appium tries to launch app multiple times. This behaviour happens both on simulator and real device.
I set enable on my iOS devices UI Automation, but when I try start inspector I have this problem:
info: [debug] [INST STDERR] 2015-11-05 15:11:05.082 instruments[1495:39489] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST STDERR] 2015-11-05 15:11:06.049 instruments[1495:39460] Attempting to change event horizon while disengage
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] [INST STDERR] 2015-11-05 15:11:06.049 instruments[1495:39462] Attempting to change event horizon while disengage
Instruments Trace Error : Target failed to run: Permission to debug com.myapp.iphone was denied. The app must be signed with a development identity (e.g. iOS Developer).
info: [IOS_SYSLOG_ROW ] Nov 5 15:11:04 tests-iPod com.apple.xpc.launchd[1] (UIKitApplication:com.myapp.iphone[0xe163][607]) <Notice>: Service exited due to signal: Killed: 9
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
info: [debug] Stopping iOS log capture
info: [debug] Reset not set, not ending sim or cleaning up app state
info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:440:31)
at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:353:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074: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 33841.937 ms - 182}
Application is in form of .ipa
Target failed to run: Permission to debug com.myapp.iphone was denied.
The app must be signed with a development identity (e.g. iOS Developer).
You application should be signed with developers key. Click here for documentation
If you are using iOS Simulator, do the following...
In Appium, go to Developer Settings, Check Custome Server Flags and write --native-instruments-lib in the text box.
Now start Appium Server.
Hope this helps!
BlockquoteTarget failed to run: Permission to debug com.myapp.iphone was denied.
The app must be signed with a development identity (e.g. iOS Developer).
Blockquote
You should give your developer identity while creating the .ipa...
If you are creating ipa file through terminal, you can follow the given link [blog]: Xcode "Build and Archive" from command line
I also struggled with this problem and found that you need to enable UI automation in developer option in you iDevice
How to enable UI Automation
1. switch off the iDevice,
2. then connect it to the Mac running Xcode
3. before switching it back on to have Developer options appear.
4. tap on developer option and Enable UI automation
In my case, the following command made my life hell:
rm -rf $HOME/Library/Developer/Xcode/iOS\ DeviceSupport/*
So don't add it to the build step.
To fix the issue:
Restart device > run Xcode > connect device > build & run the app > stop & quit Xcode
Now verify launching app without crashing the instruments.
I am trying to do the automation using Appium on ios simulators.
My config is:
OS version: 10.10.x
Appium: 1.4.0
Xcode: 6.3.2
and caps for appium is:
automationName = "Appium"
platformName = "iOS"
platformVersion = "8.3"
deviceName = "iPhone 5s"
app = "/Users/skaram200/Desktop/ios_build/XfinityMyAccount_6.3.app"
When I run the appium it is giving me an error:
info: [debug] Attempting to run app on iPhone 5s (8.3 Simulator)
info: [debug] Spawning instruments with command: /Applications/xcode6.3/Xcode6.3.2.app/Contents/Developer/usr/bin/instruments -t /Applications/xcode6.3/Xcode6.3.2.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 5s (8.3 Simulator)" /Users/skaram200/Desktop/ios_build/XfinityMyAccount_6.3.app -e UIASCRIPT "/Users/skaram200/Library/Application Support/appium/bootstrap/bootstrap-4d92d75355d74eeb.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Users/skaram200/Documents/workspace/appium_1/node_modules/appium-instruments/thirdparty/iwd6/InstrumentsShim.dylib","LIB_PATH":"/Users/skaram200/Documents/workspace/appium_1/node_modules/appium-instruments/thirdparty/iwd6"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST STDERR] 2015-09-10 10:47:20.672 instruments[36855:1272282] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST] Waiting for device to boot...
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: Unable to install app with path: /Users/skaram200/Desktop/ios_build/XfinityMyAccount_6.3.app: "(null)"
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
info: [debug] Stopping iOS log capture
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killing any other simulator daemons
info: [debug] Killall iOS Simulator
info: [debug] Cleaning sim data files
info: Executing: xcrun simctl erase F54870E7-17FD-4A07-B6EE-1636F6AB5757 with timeout 2000
info: Executing: xcrun simctl erase F54870E7-17FD-4A07-B6EE-1636F6AB5757 with timeout 2000
info: [debug] Cleaning app data files
warn: Applications directory /Users/skaram200/Library/Developer/CoreSimulator/Devices/F54870E7-17FD-4A07-B6EE-1636F6AB5757/data/Applications doesn't exist. Have you run this simulator before?
info: Couldn't find app directories to delete. Probably it's not installed
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/Users/skaram200/Documents/workspace/appium_1/node_modules/appium-instruments/lib/instruments.js:440:31)
at [object Object].<anonymous> (/Users/skaram200/Documents/workspace/appium_1/node_modules/appium-instruments/lib/instruments.js:353:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074: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}
```
Please let me know, how can I resolve these errors and start automating on ios simulators using appium.
Here you need to pass the --default-device or -dd as true for simulators and need to specify the --bundleID of the app. And we need to have debug .ipa or .app file to do automation.
Creating a successfull Build without an error.
I'm using Cordova, got some issues with that as well, this is what Idid in order to generate the .app:
cordova build ios --emulator
That's it, after that I was able to use Appium and push the .app to the simulator.
I hope it helps somebody else!
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.