Appium failed to start New Session - java

I am new to Appium. I want to launch site (amazon.in) in Chrome browser on Mobile for which I downloaded the latest appium-desktop 1.7.0 installed in my Win7 machine.
I started the Appium server running on port 5000 and clicked on start inspector section. Added Desired Capabilities under Automatic Server tab as below
{
"udid": "c78cd64b7ce4",
"browserName": "Browser",
"platformVersion": "7.1.2",
"platformName": "Android",
"noReset": true,
"automationName": "UiAutomator2",
"deviceName": "Android"
}
On clicking 'Start Session' its throwing error as "An unknown server-side error occurred while processing the command. Original error: Command 'java -version' exited with code 2"
In console logs is showng as
[2018-09-26 06:26:10][MJSONWP] Calling AppiumDriver.createSession() with args: [{"automationName":"UiAutomator2","browserName":"Browser","deviceName":"Android","noReset":false,"platformName":"Android","platformVersion":"7.1.2","udid":"c78cd64b7ce4","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[2018-09-26 06:26:10][BaseDriver] Event 'newSessionRequested' logged at 1537966570642 (18:26:10 GMT+0530 (India Standard Time))
[2018-09-26 06:26:10][Appium] Creating new AndroidUiautomator2Driver (v1.16.0) session
[2018-09-26 06:26:10][Appium] Capabilities:
[2018-09-26 06:26:10][Appium] automationName: UiAutomator2
[2018-09-26 06:26:10][Appium] browserName: Browser
[2018-09-26 06:26:10][Appium] deviceName: Android
[2018-09-26 06:26:10][Appium] noReset: false
[2018-09-26 06:26:10][Appium] platformName: Android
[2018-09-26 06:26:10][Appium] platformVersion: 7.1.2
[2018-09-26 06:26:10][Appium] udid: c78cd64b7ce4
[2018-09-26 06:26:10][Appium] newCommandTimeout: 0
[2018-09-26 06:26:10][Appium] connectHardwareKeyboard: true
[2018-09-26 06:26:10][BaseDriver] Creating session with MJSONWP desired capabilities: {"automationName":"UiAutoma...
[2018-09-26 06:26:10][BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[2018-09-26 06:26:10][BaseDriver] Session created with session id: 873dbb16-ddcb-4870-bfc6-1236da96772d
[2018-09-26 06:26:10][UiAutomator2] We're going to run a Chrome-based session
[2018-09-26 06:26:10][UiAutomator2] Chrome-type package and activity are com.android.browser and com.android.browser.BrowserActivity
[2018-09-26 06:26:11][UiAutomator2] Deleting UiAutomator2 session
[2018-09-26 06:26:11][BaseDriver] Event 'newSessionStarted' logged at 1537966571337 (18:26:11 GMT+0530 (India Standard Time))
[2018-09-26 06:26:11][MJSONWP] Encountered internal error running command: Error: Command 'java -version' exited with code 2
[2018-09-26 06:26:11][MJSONWP] at ChildProcess. (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:94:19)
[2018-09-26 06:26:11][MJSONWP] at emitTwo (events.js:126:13)
[2018-09-26 06:26:11][MJSONWP] at ChildProcess.emit (events.js:214:7)
[2018-09-26 06:26:11][MJSONWP] at maybeClose (internal/child_process.js:925:16)
[2018-09-26 06:26:11][MJSONWP] at Socket.stream.socket.on (internal/child_process.js:346:11)
[2018-09-26 06:26:11][MJSONWP] at emitOne (events.js:116:13)
[2018-09-26 06:26:11][MJSONWP] at Socket.emit (events.js:211:7)
[2018-09-26 06:26:11][MJSONWP] at Pipe._handle.close [as _onclose] (net.js:554:12)
[2018-09-26 06:26:11][HTTP] <-- POST /wd/hub/session 500 700 ms - 179
[2018-09-26 06:26:11][HTTP]

Related

Getting A new session could not be created

Can anyone help me out I am new to Android testing with Appium , I am trying to open app in AVD the app getting installed but then m getting Error "A new Session could not be created.(Original error: Command failed: )","killed":false,"code":1,"signal":null,"origValue":"Command failed: "},"sessionId":null}
Thanks for the help in advance
tried with just giving capabilities.setCapability("appActivity", ".MainActivity");
'''
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "/Apps/src/");
File app = new File(appDir, "ChatApp-release.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName", "emulator-5554");
capabilities.setCapability("platformVersion", "7.1.1");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.aaa.charla");
capabilities.setCapability("appActivity", "com.aaa.xxx.MainActivity");
driver = new AndroidDriver(new URL("https://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
Thread.sleep(10000);
driver.quit();
Following are the Debug log:
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk","appPackage":"com.odysseyinc.charla","appActivity":"com.odyssey.chatapp.MainActivity","newCommandTimeout":"10000","platformName":"Android","version":"7.1.1","deviceName":"emulator-5554"}}
info: Client User-Agent string: Apache-HttpClient/4.5.2 (Java/1.8.0_162)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
info: [debug] Using local app from desired caps: D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk
info: [debug] Creating new appium session 0d25aeac-d055-449f-af84-b6d314d9b4a5
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_162
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe
info: [debug] Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 25
info: Device API level is: 25
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language:
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk" "C:\Users\UNMESH~1.GHA\AppData\Local\Temp\com.odysseyinc.charla"
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 push "C:\Users\UNMESH~1.GHA\AppData\Local\Temp\com.odysseyinc.charla\strings.json" /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\aapt.exe dump xmltree D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk AndroidManifest.xml
info: [debug] Set app process to: com.odysseyinc.charla
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk.
info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk
info: [debug] App already signed.
info: [debug] Zip-aligning D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\build-tools\28.0.3\zipalign.exe -f 4 D:\AndroidNew\Yrreport\YrReport\RemoteSystemsTempFiles\Appium\apk\ChatApp-master-0.9.35.1195-release.apk C:\Users\UNMESH~1.GHA\AppData\Local\Temp\119427-15556-1rmbgw9\appium.tmp
info: [debug] MD5 for app is f3d7efc8b197792c3d0529a48dc92ff2
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "ls /data/local/tmp/f3d7efc8b197792c3d0529a48dc92ff2.apk"
info: [debug] Getting install status for com.odysseyinc.charla
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 25
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "pm list packages -3 com.odysseyinc.charla"
info: [debug] App is installed
info: App is already installed, resetting app
info: [debug] Running fast reset (stop and clear)
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "am force-stop com.odysseyinc.charla"
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell "pm clear com.odysseyinc.charla"
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: C:\Users\unmesh.ghatbandhe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
error: Failed to start an Appium session, err was: Error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]
at ChildProcess.exithandler (child_process.js:637:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\r\n)","killed":false,"code":1,"signal":null,"origValue":"Command failed: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]\r\n"},"sessionId":null}
info: <-- POST /wd/hub/session 500 32039.992 ms - 664
`
You need to share the full appium logs in order to know the reason for that.
[After checking the logs]
That's a known issue for that specific Android image as it installs 2 versions of appium settings app and unlock app. What you can do is either change the android image you are testing against or uninstall those 2 apps before starting your script.
You can uninstall them manually by starting the emulator GUI and do that with the mouse or through the below commands:
adb -s device_serial uninstall io.appium.settings
adb -s device_serial uninstall io.appium.unlock
Also, you can add those commands in your code if you really have to execute the tests on android 7 devices as below:
String androidVersion=executeCommand("adb shell getprop ro.build.version.release");
if(androidVersion.contains("7"))
{
//uninstall appium settings app
cmd="adb uninstall io.appium.settings";
executeCommand(cmd);
//uninstall appium unlock app
cmd="adb uninstall io.appium.unlock";
executeCommand(cmd);
}
I have upgraded the Appuim 1.4 to 1.9 and started working as Expected .

Appium Request to register with grid was unsuccessful: Error: getaddrinfo ENOTFOUND http http:80 while starting Selenium Grid Node

I'm at my wits end with this. I am trying to connect Appium (command line) through an attached device that is visible with adb devices. The grid is launched with the following conmmand
java -jar ../../selenium-server-standalone-3.6.0.jar -role hub -hubConfig ./hubconfig.json
and spins up as it should with the following:
C:\projects\mfa-functional\Selenium Batch Files>java -jar
C:/Selenium/SeleniumGrid/selenium-server-standalone-3.6.0.jar -role hub -
hubConfig C:/Selenium/SeleniumGrid/BatchFiles/Hub/hubconfig.json
13:40:15.686 INFO - Selenium build info: version: '3.6.0', revision:
'6fbf3ec767'
13:40:15.687 INFO - Launching Selenium Grid hub
2018-04-25 13:40:16.708:INFO::main: Logging initialized #1540ms to
org.seleniumhq.jetty9.util.log.StdErrLog
13:40:16.725 INFO - Will listen on 4444
2018-04-25 13:40:16.781:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2018-04-25 13:40:16.816:INFO:osjs.session:main: DefaultSessionIdManager
workerName=node0
2018-04-25 13:40:16.816:INFO:osjs.session:main: No SessionScavenger set,
using defaults
2018-04-25 13:40:16.818:INFO:osjs.session:main: Scavenging every 600000ms
2018-04-25 13:40:16.825:INFO:osjsh.ContextHandler:main: Started
o.s.j.s.ServletContextHandler#2d2e5f00{/,null,AVAILABLE}
2018-04-25 13:40:16.852:INFO:osjs.AbstractConnector:main: Started
ServerConnector#5b0abc94{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-04-25 13:40:16.852:INFO:osjs.Server:main: Started #1686ms
13:40:16.853 INFO - Nodes should register to
http://127.0.0.1:4444/grid/register/
13:40:16.853 INFO - Selenium Grid hub is up and running
with the following config.json
{
"host": "127.0.0.1",
"maxSessions": 35,
"port": 4444,
"cleanupCycle": 5000,
"timeout": 300000,
"newSessionWaitTimeout": -1,
"servlets": [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 180000,
"platform": "WINDOWS"
}
I am trying to spin up a node to connect to this hub with the following command
appium -a 127.0.0.1 --nodeconfig MKs_tablet.json
MKs_tablet.json looks as follows
{
"capabilities":
[
{
"appiumVersion" : "1.8.0",
"browserName": "andriod",
"version":"4.4.2",
"maxInstances": 1,
"platform":"Android",
"deviceName" : "KJOVSCGISWSC8HOV"
}
],
"configuration" :
{
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 2,
"url":"http://http://127.0.0.1:4723/wd/hub",
"host" : "http://127.0.0.1",
"port": 4723,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "http://127.0.0.1",
"nodeStatusCheckTimeout": 5000
}
}
The appium node spins up just fine, but cannot seem to connect to the grid hub. The result is as follows:
C:\Selenium\SeleniumGrid\ExternalDeviceConfig\Appium Device Configs>appium -
a 127.0.0.1 --nodeconfig MKs_tablet.json
[Appium] Welcome to Appium v1.8.0
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] nodeconfig: MKs_tablet.json
[debug] [Appium] Starting auto register thread for grid. Will try to
register every 5000 ms.
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo
ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND
http http:80
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo
ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND
http http:80
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo
ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND
http http:80
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo
ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND
http http:80
Am I just overlooking something be cause there just doesn't seem to be anything suggested out there. I can find anything wrong with my config files. It looks like it should work
HELP!!!
This error message...
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND http http:80
...implies that the Appium Client was unable to register with the Selenium Grid Hub
Your main issue is within the --nodeconfig for the parameter url within MKs_tablet.json where the protocol http is specified twice.
Solution
Within --nodeconfig, the parameter url within MKs_tablet.json must be set as :
"url":"http://127.0.0.1:4723/wd/hub"

Error: Command 'java -version' exited with code 20

I run the android automation test from eclipse it throws
Encountered internal error running command: Error: Command 'java -version' exited with code 20
Appium Logfile:
`[BaseDriver] Event 'newSessionRequested' logged at 1519716463353
(12:57:43 GMT+0530 (IST)) [Appium] Merged W3C capabilities
{"desiredCapabilities":{"app":"/Users/sathish/S... into
desiredCapabilities object
{"app":"/Users/sathish/Sathish/CASA/Automation ... [Appium] Creating
new AndroidDriver (v1.39.0) session [Appium] Capabilities: [Appium]
app: /Users/sathish/Sathish/CASA/Automation
Test/EndlessAisleAutomationTest/app/app-qa-debug.apk [Appium]
appActivity: tech.ajira.endlessAisle.activities.TenantLoginActivity
[Appium] appPackage: tech.ajira.endlessAisle [Appium]
deviceName: Google Nexus 9 [Appium] platformName: android
[BaseDriver] [BaseDriver] W3C capabilities [] and MJSONWP desired
capabilities were provided [BaseDriver] Expected W3C "capabilities"
to be a JSON Object but was provided with: [] [BaseDriver] Falling
back to MJSONWP desired capabilities [BaseDriver] Session created
with session id: e1e27d58-611a-4877-b8fc-8e7e98351be1
[AndroidDriver] Getting Java version [AndroidDriver] Shutting down
Android driver [AndroidDriver] Called deleteSession but bootstrap
wasn't active [MJSONWP] Encountered internal error running command:
Error: Command 'java -version' exited with code 20
at ChildProcess. (/Applications/Appium.app/Contents/Resources/app/node_modules/teen_process/lib/teen_process.js:97:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at maybeClose (internal/child_process.js:899:16)
at Socket. (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at Pipe._handle.close [as _onclose] (net.js:510:12) [HTTP] <-- POST /wd/hub/session 500 41 ms - 180`
Please help me to fix this issue. Thank you
Seems Appium is not able to connect to the running emulator. Try setting correct values for deviceName and platformVersion capabilities to find the connected device.
In command prompt try running adb devices to get the device name.

Appium frozen when sending command to Android

When android driver finding some element, appium frozen ([AndroidBootstrap] Sending command to android) and will die after some time. This happens only on one computer (Mac) and only on android.
At last appium sending this:
[Appium] New AndroidDriver session created successfully, session 7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d added to master session list
[debug] [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"/Users/jenkins/.jenkins/jobs/Android5-test-ReleaseIntegtationTests-Demo/workspace/test-Integration-Tests/src/test/resources/testDemo-debug.apk","noReset":true,"newCommandTimeout":88,"udid":"018433348882859","platformName":"Android","deviceName":"Android","fullReset":false},"app":"/Users/jenkins/.jenkins/jobs/Android5-test-ReleaseIntegtationTests-Demo/workspace/test-Integration-Tests/src/test/resources/testDemo-debug.apk","noReset":true,"newCommandTimeout":88,"udid":"018433348882859","platformName":"Android","deviceName":"018433348882859","fullReset":false,"deviceUDID":"018433348882859","platformVersion":"5.1.1","appPackage":"com.my.testApp","appWaitPackage":"com.my.testApp","appActivity":"com.my.testApp.MainActivity","appWaitActivity":"com.my.targetDem...
[HTTP] <-- POST /wd/hub/session 200 6192 ms - 1112
[HTTP] --> GET /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d {}
[debug] [MJSONWP] Calling AppiumDriver.getSession() with args: ["7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d"]
[debug] [MJSONWP] Responding to client with driver.getSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"/Users/jenkins/.jenkins/jobs/Android5-test-ReleaseIntegtationTests-Demo/workspace/test-Integration-Tests/src/test/resources/testDemo-debug.apk","noReset":true,"newCommandTimeout":88,"udid":"018433348882859","platformName":"Android","deviceName":"Android","fullReset":false},"app":"/Users/jenkins/.jenkins/jobs/Android5-test-ReleaseIntegtationTests-Demo/workspace/test-Integration-Tests/src/test/resources/testDemo-debug.apk","noReset":true,"newCommandTimeout":88,"udid":"018433348882859","platformName":"Android","deviceName":"018433348882859","fullReset":false,"deviceUDID":"018433348882859","platformVersion":"5.1.1","appPackage":"com.my.testApp","appWaitPackage":"com.my.testApp","appActivity":"com.my.testApp.MainActivity","appWaitActivity":"com.my.targetDem...
[HTTP] <-- GET /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d 200 5 ms - 1112
[HTTP] --> GET /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d {}
[debug] [MJSONWP] Calling AppiumDriver.getSession() with args: ["7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d"]
[debug] [MJSONWP] Responding to client with driver.getSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"/Users/jenkins/.jenkins/jobs/Android5-test-ReleaseIntegtationTests-Demo/workspace/test-Integration-Tests/src/test/resources/testDemo-debug.apk","noReset":true,"newCommandTimeout":88,"udid":"018433348882859","platformName":"Android","deviceName":"Android","fullReset":false},"app":"/Users/jenkins/.jenkins/jobs/Android5-test-ReleaseIntegtationTests-Demo/workspace/test-Integration-Tests/src/test/resources/testDemo-debug.apk","noReset":true,"newCommandTimeout":88,"udid":"018433348882859","platformName":"Android","deviceName":"018433348882859","fullReset":false,"deviceUDID":"018433348882859","platformVersion":"5.1.1","appPackage":"com.my.testApp","appWaitPackage":"com.my.testApp","appActivity":"com.my.testApp.MainActivity","appWaitActivity":"com.my.targetDem...
[HTTP] <-- GET /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d 200 3 ms - 1112
[HTTP] --> POST /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d/timeouts {"type":"implicit","ms":10000}
[debug] [MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",10000,"7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d"]
[debug] [BaseDriver] Set implicit wait to 10000ms
[debug] [MJSONWP] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d/timeouts 200 3 ms - 76
[HTTP] --> POST /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d/timeouts {"type":"implicit","ms":1000}
[debug] [MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",1000,"7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d"]
[debug] [BaseDriver] Set implicit wait to 1000ms
[debug] [MJSONWP] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d/timeouts 200 3 ms - 76
[HTTP] --> POST /wd/hub/session/7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d/elements {"using":"id","value":"com.my.testApp:id/card_view"}
[debug] [MJSONWP] Calling AppiumDriver.findElements() with args: ["id","com.my.testApp:id/card_view","7de5c8a9-3d5e-49dc-b228-3b76f0cf5f1d"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 1000 ms for condition
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.my.testApp:id/card_view","context":"","multiple":true}}
Appium: 1.6.1
io.appium:java-client:5.0.0-BETA3
ADB: 1.0.36
Appium Capabilities:
File appDir = new File(System.getProperty("user.dir") + properties.getProperty("appDir"));
File app = new File(appDir, System.getProperty("appName"));
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, System.getProperty("platform"));
capabilities.setCapability(MobileCapabilityType.UDID, System.getProperty("udid"));
capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 88);
androidDriver = new AndroidDriver(new URL(System.getProperty("appiumUrl")), capabilities);
androidDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Any ideas?
Reinstalling appium 1.6.1 not helped me.
But I resolved my issue after downgrade appium to 1.5.3 and upgrade back to 1.6.1.
Apparently version 1.5.3 pulled up the missing libraries. But why 1.6.1 didn't do it I don't know.

Appium error : A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT) [duplicate]

This question already has answers here:
A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT)
(3 answers)
Closed 7 years ago.
Code from eclipse :
public class desiredcapabilities {
#Test
public void test() throws IOException {
File appDir = new File("src");
File app = new File(appDir,"bookMyShow-ucb.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
//cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
cap.setCapability(MobileCapabilityType.APP, app.getCanonicalPath());
AndroidDriver Driver = new AndroidDriver(new URL("http://127.0.0.1:4724/wd/hub"),cap);
}
}
Appium Log :
Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4724 --session-override --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
warn: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!
info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)
info: Appium REST http interface listener started on 127.0.0.1:4724
info: [debug] Non-default server args: {"address":"127.0.0.1","port":4724,"sessionOverride":true,"logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"C:\Users\sahil\workspace\intro\src\bookMyShow-ucb.apk","platformName":"Android","deviceName":"Android Emulator"}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.7.0_79)
info: [debug] No appActivity desired capability or server param. Parsing from apk.
info: [debug] No appPackage desired capability or server param. Parsing from apk.
info: [debug] Using local app from desired caps: C:\Users\sahil\workspace\intro\src\bookMyShow-ucb.apk
info: [debug] Creating new appium session 16b1787e-64bd-4bc5-b009-a0a518730ae0
error: Failed to start an Appium session, err was: Error: 'java -version' failed. Error: spawn ENOENT
info: Starting android appium
info: [debug] Getting Java version
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: 'java -version' failed. Error: spawn ENOENT
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:1057:17)
at exithandler (child_process.js:633:7)
at ChildProcess.errorhandler (child_process.js:649:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:795:12)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT)","origValue":"'java -version' failed. Error: spawn ENOENT"},"sessionId":null}
info: <-- POST /wd/hub/session 500 181.826 ms - 208
Upgrade your node click here
Should work
Looks like your node version is less than the required for Appium 1.4.13.
automation-name Appium --log-no-color warn: Appium support for versions of node < 0.12
Check your node version like this:
node --version v0.12.4

Categories

Resources