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

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.

Related

Appium failed to start New Session

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]

Appium scripts are getting failed, after hitting url successful

Appium scripts are getting failed, after hitting url successful.
Selenium Oxygen 2
Appium version 1.2.7
Url hit the browser open the link, after some page gates refreshed and then again url reopened in new tab within the same chrome browser.
url " us.justdial.com" opeing in the chrome browser still scripts are getting failed. Have already updated chrome driver.
Below are the scripts
import java.net.MalformedURLException;
import java.net.URL;
//import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeUnit;
/*import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.Timeouts;
import org.openqa.selenium.chrome.ChromeDriver;*/
//import org.openqa.selenium.android.AndroidDriver;
//import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
//import org.openqa.selenium.remote.RemoteWebDriver;
//import org.openqa.selenium.remote.RemoteWebDriver;
//import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
//import io.appium.java_client.remote.MobileCapabilityType;
public class Appium_device {
//String driverPath = "F:/ChromeDriver/chromedriver.exe";
public AppiumDriver driver;
#Test
public void Appium_device() throws MalformedURLException, Exception {
{
// APPLICATION_LOG.info("Initializing project properties");
DesiredCapabilities capabilities = new DesiredCapabilities();
// Set android deviceName desired capability. Set your device name.
// capabilities.setCapability("deviceName", "5203a1bbea4a8385");
// capabilities.setCapability("deviceName", "4100df0accbd9f00");
// capabilities.setCapability("deviceName", "0123456789ABCDEF");
capabilities.setCapability("deviceName", "4d007af54ac04177");
// Set BROWSER_NAME desired capability. It's Android in our case here.
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
// capabilities.setCapability("browsername", "chrome");
capabilities.setCapability("chromedriverExecutable", "C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe");
// Set android VERSION desired capability. Set your mobile device's OS version.
// capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
// capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
// Set android platformName desired capability. It's Android in our case here.
capabilities.setCapability("platformName", "Android");
// Set android appPackage desired capability. It is
// com.android.calculator2 for calculator application.
// Set your application's appPackage if you are using any other app.
// capabilities.setCapability("appPackage", "org.mozilla.firefox");
capabilities.setCapability("appPackage", "com.android.chrome");
// Set android appActivity desired capability. It is
// com.android.calculator2.Calculator for calculator application.
// Set your application's appPackage if you are using any other app.
capabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main");
// Created object of RemoteWebDriver will all set capabilities.
// Set appium server address and port number in URL string.
// It will launch calculator app in android device.
// webdriver.Chrome(executable_path='C:\Users\Ganeshkumarg\Downloads\chromedriver_win32\chromedriver.exe');
// RemoteWebDriver webDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
// webDriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
try {
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
}catch(MalformedURLException e)
{
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
System.out.println("Step 9");
try {
driver.get("https://us.justdial.com");
System.out.println("site hit");
}
catch (Exception e) {
System.out.println("site not accessed");
throw (e);
// TODO: handle exception
}
}
}
}
Following are the appium error logs
[Appium] Welcome to Appium v1.7.1
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"capabilities":{"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"firstMatch":[{"browserName":"Android","platformName":"android"}]}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},null,{"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"firstMatch":[{"browserName":"Android","platformName":"android"}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1515140901130 (13:58:21 GMT+0530 (India Standard Time))
[Appium] Creating new AndroidDriver (v1.28.1) session
[Appium] Capabilities:
[Appium] appActivity: 'com.google.android.apps.chrome.Main'
[Appium] appPackage: 'com.android.chrome'
[Appium] browserName: 'Android'
[Appium] chromedriverExecutable: 'C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe'
[Appium] deviceName: '4d007af54ac04177'
[Appium] platformName: 'Android'
[Appium] version: '6.0.1'
[BaseDriver] The following capabilities were provided, but are not recognized by appium: version.
[BaseDriver] Session created with session id: b284c843-d3e4-4d13-94aa-a9f752377fe8
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_144
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Using device: 4d007af54ac04177
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe
[ADB] Setting device id to 4d007af54ac04177
[AndroidDriver] App file was not listed, instead we're going to run com.android.chrome directly on the device
[AndroidDriver] Checking whether package is present on the device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","com.android.chrome"]
[AndroidDriver] Starting Android session
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","wait-for-device"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","echo","ping"]
[Logcat] Starting logcat capture
[AndroidDriver] Pushing settings apk to device...
[ADB] Uninstalling and re-installing 'io.appium.settings'
[ADB] Uninstalling io.appium.settings
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","io.appium.settings"]
[ADB] App is installed
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","force-stop","io.appium.settings"]
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","uninstall","io.appium.settings"]
[ADB] ADB command output: Success
[ADB] io.appium.settings was successfully uninstalled
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","io.appium.settings"]
[ADB] App is not installed
[ADB] App 'C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk' not installed. Installing
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","install","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\io.appium.settings\\app\\build\\outputs\\apk\\settings_apk-debug.apk"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.build.version.sdk"]
[ADB] Current device property 'ro.build.version.sdk': 23
[ADB] Device API level: 23
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","dumpsys","package","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","dump","io.appium.settings"]
[ADB] Got the following command chunks to execute: pm,grant,io.appium.settings,android.permission.INTERNET,;,pm,grant,io.appium.settings,android.permission.CHANGE_NETWORK_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_NETWORK_STATE,;,pm,grant,io.appium.settings,android.permission.READ_PHONE_STATE,;,pm,grant,io.appium.settings,android.permission.WRITE_SETTINGS,;,pm,grant,io.appium.settings,android.permission.CHANGE_WIFI_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_WIFI_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_FINE_LOCATION,;,pm,grant,io.appium.settings,android.permission.ACCESS_COARSE_LOCATION,;,pm,grant,io.appium.settings,android.permission.ACCESS_MOCK_LOCATION,;,pm,grant,io.appium.settings,android.permission.SET_ANIMATION_SCALE,;
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","grant","io.appium.settings","android.permission.INTERNET",";","pm","grant","io.appium.settings","android.permission.CHANGE_NETWORK_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_NETWORK_STATE",";","pm","grant","io.appium.settings","android.permission.READ_PHONE_STATE",";","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.CHANGE_WIFI_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_WIFI_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_FINE_LOCATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_COARSE_LOCATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";","pm","grant","io.appium.settings","android.permission.SET_ANIMATION_SCALE",";"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","ps"]
[ADB] Device API level: 23
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-n","io.appium.settings/.Settings","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[ADB] Device API level: 23
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","appops","set","io.appium.settings","android:mock_location","allow"]
[AndroidDriver] Pushing unlock helper app to device...
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","install","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-debug.apk"]
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.build.version.release"]
[ADB] Current device property 'ro.build.version.release': 6.0.1
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","wm","size"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.product.model"]
[ADB] Current device property 'ro.product.model': SM-G900H
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.product.manufacturer"]
[ADB] Current device property 'ro.product.manufacturer': samsung
[AndroidDriver] No app sent in, not parsing package/activity
[AndroidDriver] No app capability. Assuming it is already on the device
[AndroidDriver] Running fast reset (stop and clear)
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","force-stop","com.android.chrome"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","clear","com.android.chrome"]
[AndroidBootstrap] Watching for bootstrap disconnect
[ADB] Forwarding system: 4724 to device: 4724
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","forward","tcp:4724","tcp:4724"]
[UiAutomator] Starting UiAutomator
[UiAutomator] Moving to state 'starting'
[UiAutomator] Parsing uiautomator jar
[UiAutomator] Found jar name: 'AppiumBootstrap.jar'
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","push","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar","/data/local/tmp/"]
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting all processes with uiautomator
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[UiAutomator] Starting UIAutomator
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","4d007af54ac04177","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.android.chrome","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false]
[UiAutomator] Moving to state 'online'
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
[AndroidBootstrap] Android bootstrap socket is now connected
[ADB] Getting connected devices...
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","dumpsys","window"]
[AndroidDriver] Screen already unlocked, doing nothing
[ADB] Device API level: 23
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-n","com.android.chrome/com.google.android.apps.chrome.Main","-S"]
[Appium] New AndroidDriver session created successfully, session b284c843-d3e4-4d13-94aa-a9f752377fe8 added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1515140936767 (13:58:56 GMT+0530 (India Standard Time))
[MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1","deviceUDID":"4d007af54ac04177","platformVersion":"6.0.1","deviceScreenSize":"1080x1920","deviceModel":"SM-G900H","deviceManufacturer":"samsung"}
[HTTP] <-- POST /wd/hub/session 200 35735 ms - 978
[HTTP] --> POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/timeouts {"type":"implicit","ms":10000}
[MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",10000,"b284c843-d3e4-4d13-94aa-a9f752377fe8"]
[BaseDriver] Set implicit wait to 10000ms
[MJSONWP] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/timeouts 200 5 ms - 76
[HTTP] --> POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/url {"url":"https://us.justdial.com"}
[MJSONWP] Calling AppiumDriver.setUrl() with args: ["https://us.justdial.com","b284c843-d3e4-4d13-94aa-a9f752377fe8"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-a","android.intent.action.VIEW","-d","https://us.justdial.com","com.android.chrome"]
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-a","android.intent.action.VIEW","-d","https://us.justdial.com","com.android.chrome"]
[ADB] Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/url 500 40572 ms - 553
Frequent Error:
An unknown server-side error occurred while processing the command. Original error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null' (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Please look into same.
Since you are trying to test web app in browser, why not to do it this way:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.BROWSER);
// if chrome is installed, but not default one - use MobileBrowserType.CHROME
AppiumDriver<MobileElement> driver = new AndroidDriver<>(
new URL("http://127.0.0.1:4723/wd/hub"),
capabilities
);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://us.justdial.com");
It works perfectly for me with Appium java client 5.0.4 / server 1.7.1
Removed "Unlock" and "Appium settings" apps from device - Appium installs those apps automatically.
Also, passed appium arguments in my scripts. Below are the changes:
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.appium.java_client.AppiumDriver;
public class Appium_device {
//String driverPath = "F:/ChromeDriver/chromedriver.exe";
AppiumDriver<?> driver;
#BeforeTest
public void Appium_device() throws MalformedURLException, Exception {
{
// APPLICATION_LOG.info("Initializing project properties");
DesiredCapabilities capabilities = new DesiredCapabilities();
// Set android deviceName desired capability. Set your device name.
// capabilities.setCapability("deviceName", "5203a1bbea4a8385");
// capabilities.setCapability("deviceName", "4100df0accbd9f00");
// capabilities.setCapability("deviceName", "0123456789ABCDEF");
capabilities.setCapability("deviceName", "4d007af54ac04177");
// Set BROWSER_NAME desired capability. It's Android in our case here.
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
// capabilities.setCapability("browsername", "chrome");
// capabilities.setCapability("chromedriverExecutable", "C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe");
// Set android VERSION desired capability. Set your mobile device's OS version.
// capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
// capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
// Set android platformName desired capability. It's Android in our case here.
capabilities.setCapability("platformName", "Android");
// Set android appPackage desired capability. It is
// com.android.calculator2 for calculator application.
// Set your application's appPackage if you are using any other app.
// capabilities.setCapability("appPackage", "org.mozilla.firefox");
capabilities.setCapability("appPackage", "com.android.chrome");
// Set android appActivity desired capability. It is
// com.android.calculator2.Calculator for calculator application.
// Set your application's appPackage if you are using any other app.
capabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main");
// capability.setCapability("binary", "C:\Program Files\Google\Chrome\Application");
// Created object of RemoteWebDriver will all set capabilities.
// Set appium server address and port number in URL string.
// It will launch calculator app in android device.
// webdriver.Chrome(executable_path='C:\Users\Ganeshkumarg\Downloads\chromedriver_win32\chromedriver.exe');
// RemoteWebDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
// webDriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
// capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
// capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.BROWSER);
driver = new AppiumDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
}
#Test
public void launch() throws Exception {
try {
//driver.get("https://us.justdial.com");
driver.navigate().to("https://us.justdial.com");
System.out.println("site hit");
}
catch (Exception e) {
System.out.println("site not accessed");
throw (e);
// TODO: handle exception
}
}}
Thanks a ton to all for your helpful suggestions.

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

Appium: How do you run Java tests and devices on local machine against a remote appium server

Is it possible to have Appium running on a remote machine, while having a device connected to a local machine, and also run the tests from the local machine?
Currently, Appium continues to check adb for devices where Appium is running (which of course there is none) and fails after timing out. I have zero problems running Appium locally.
Here are my Capabilities running from the Local machine where the device is connected ( IP: 192.168.1.78 ) :
#Before
public void setUp() throws Exception
{
final DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("appium-version", "1.2");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("deviceName", "SCH-I545");
capabilities.setCapability("appPackage", "<appPackage_goes_here>");
capabilities.setCapability("appActivity", "<appActivity_goes_here>");
driver = new AppiumDriver(new URL("http://192.168.2.109:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
And here is the Appium Console Log from the Remote machine ( IP: 192.168.2.109 ):
QA1#QA1s-Mac-mini:3.2: ~/appium :$node .
info: Welcome to Appium v1.2.0 (REV 83e64a139b928fb1f6c06e50370f9f0140ecaa30)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4","platformName":"Android","deviceName":"SCH-I545","browserName":"","appActivity":"com.alldigital.android.cox.NewsActivity","appium-version":"1.2","appPackage":"com.cmgdigital.wsoctvhandset"}}
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. : appium-version
debug: Didn't get app but did get Android package, will attempt to launch it on the device
debug: Creating new appium session b184a564-321d-4753-af63-9bd7fbf56b6e
info: Starting android appium
debug: Using fast reset? true
debug: Preparing device for session
debug: Not checking whether app is present since we are assuming it's already on the device
debug: Checking whether adb is present
debug: Using adb from /Users/QA1/android-sdk-macosx/sdk/platform-tools/adb
info: Retrieving device
debug: Trying to find a connected android device
debug: Getting connected devices...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" devices
debug: 0 device(s) connected
debug: Could not find devices, restarting adb server...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" kill-server
debug: Getting connected devices...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" devices
debug: 0 device(s) connected
....... continues trying .......
debug: Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
debug: Cleaning up android objects
debug: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Could not find a connected Android device.
debug: Error: Could not find a connected Android device.
at ADB.getDevicesWithRetry (/Users/QA1/appium/node_modules/appium-adb/lib/adb.js:612:15)
at androidCommon.prepareActiveDevice (/Users/QA1/appium/lib/devices/android/android-common.js:354:12)
at null.<anonymous> (/Users/QA1/appium/lib/devices/android/android-common.js:294:26)
at /Users/QA1/appium/node_modules/async/lib/async.js:610:21
at /Users/QA1/appium/node_modules/async/lib/async.js:249:17
at iterate (/Users/QA1/appium/node_modules/async/lib/async.js:149:13)
at /Users/QA1/appium/node_modules/async/lib/async.js:160:25
at /Users/QA1/appium/node_modules/async/lib/async.js:251:21
at /Users/QA1/appium/node_modules/async/lib/async.js:615:34
at androidCommon.prepareEmulator (/Users/QA1/appium/lib/devices/android/android-common.js:344:5)
debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find a connected Android device.)","origValue":"Could not find a connected Android device."},"sessionId":null}
info: <-- POST /wd/hub/session 500 30473.764 ms - 206
Try to use:
driver = new RemoteWebDriver(new URL("http://192.168.2.109:4723/wd/hub"), capabilities);

Categories

Resources