0
votes

WINDOWS 7 Appium :1.4.16.1 Emulator Android from Android Virtual Device Manager

APPIUM REST RESPONSE:

Thanks for letting me know. if you think of what could be the source cause.

CODE FROM ECLIPSE:

'import org.openqa.selenium.By;
 import org.openqa.selenium.chrome.ChromeDriverService;
 import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.remote.RemoteWebDriver;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import io.appium.java_client.MobileElement;
 import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.ios.IOSElement;
 import io.appium.java_client.remote.MobileBrowserType;
 import io.appium.java_client.remote.MobileCapabilityType;
 import io.appium.java_client.remote.MobilePlatform;
 import org.openqa.selenium.Platform;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.remote.BrowserType;
 import java.util.concurrent.TimeUnit;

 //WebDriver driver;
 public class AA_Android1

 @Test
 public void test1() throws MalformedURLException, InterruptedException{

 DesiredCapabilities capabilities = new DesiredCapabilities();
 File app = new File("C:/Users/dd/Downloads/com.google.android.gm.4.5.apk");
 capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"emulator-      5554");
 capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
 capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "BROWSER");
 capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "6.0");
 capabilities.setCapability("appPackage", "com.android.browser");
      capabilities.setCapability("appActivity","com.android.browser.BrowserActivity");          

 capabilities.setCapability("browserName", MobileBrowserType.BROWSER);

 WebDriver driver = new AndroidDriver<MobileElement>(new              URL("http://127.0.0.1:4723/wd/hub"), capabilities );//error?
 driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);'

APPIUM LOG: '> Launching Appium server with command: C:\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --browser-name Chrome --session-override --platform-name Android --platform-version 23 --automation-name Appium --device-name "emulator-5554" --log-no-color

info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d) info: Appium REST http interface listener started on 127.0.0.1:4723 info: [debug] Non-default server args: {"address":"127.0.0.1","sessionOverride":true,"logNoColors":true,"deviceName":"emulator-5554","platformName":"Android","platformVersion":"23","automationName":"Appium","browserName":"Chrome"} info: Console LogLevel: debug info: --> POST /wd/hub/session {"capabilities":{"desiredCapabilities":{"appPackage":"com.android.browser","appActivity":"com.android.browser.BrowserActivity","platformVersion":"6.0","browserName":"Browser","platformName":"Android","deviceName":"emulator-5554"},"requiredCapabilities":{}},"desiredCapabilities":{"appPackage":"com.android.browser","appActivity":"com.android.browser.BrowserActivity","platformVersion":"6.0","browserName":"Browser","platformName":"Android","deviceName":"emulator-5554"},"requiredCapabilities":{}} info: Client User-Agent string: Apache-HttpClient/4.5.2 (Java/1.8.0_121) info: Set mode: Proxying straight through to Chromedriver info: [debug] Looks like we want chrome on android info: [debug] Creating new appium session 6f152533-ef46-4327-9543-c62fb07906ad info: [debug] Checking whether adb is present info: [debug] Using adb from C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe info: [debug] Using fast reset? true info: [debug] Preparing device for session info: [debug] Not checking whether app is present since we are assuming it's already on the device info: Retrieving device info: [debug] Trying to find a connected android device info: [debug] Getting connected devices... info: [debug] executing cmd: C:\Users\ddaunay\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\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device info: [debug] executing cmd: C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "echo 'ready'" info: [debug] Starting logcat capture info: [debug] Pushing unlock helper app to device... info: [debug] executing cmd: C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 install "C:\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk" info: [debug] executing cmd: C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "dumpsys window" info: [debug] Screen already unlocked, continuing. info: [debug] Forwarding system:4724 to device:4724 info: [debug] executing cmd: C:\Users\ddaunay\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\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 push "C:\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/ info: Starting App info: [debug] Attempting to kill all 'uiautomator' processes info: [debug] Getting all processes with 'uiautomator' info: [debug] executing cmd: C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'" info: [debug] Cleaning up appium session error: Failed to start an Appium session, err was: Error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'""

info: [debug] Error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'""

at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)

info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c \"C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell \"ps 'uiautomator'\"\"\n)","killed":false,"code":1,"signal":null,"cmd":"C:\Windows\system32\cmd.exe /s /c \"C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554c\"\"","origValue":"Command failed: C:\Windows\system32\cmd.exe /s /c \"C:\Users\ddaunay\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell \"ps 'uiautomator'\"\"\n"},"sessionId":null} info: <-- POST /wd/hub/session 500 10097.767 ms - 679 info: [debug] Logcat terminated with code 0, signal null'

1
Did u check the device names in command prompt by running the command "adb devices"SaiPawan

1 Answers

0
votes

We faced a similar issue when working with Appium 1.4.16 version, and we have searched a lot in different forums and appium related support forumns. came to know that it is an issue and they gave an alternative for users to continue to work till they fix this in next releases.

Basically we need to modify file adb.js present inside of appium folder: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\

Drafted those details clearly @ http://www.testingtools.co/appium/error-command-failed-adb-exe-s-emulator-5554-shell-ps-uiautomator

hope it helps and you will be abl