新手,刚运行 appium 的时候,报 error: Logcat capture failed: spawn ENOENT。但是我的 sdk 路径中没有空格。
实在不愿意做伸手党,但是没有办法,解决不了了。
大侠们帮我看看。
Checking if an update is available
Update not available
Starting Node Server
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"19","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4","deviceName":"8f7581e5","platformName":"Android","browserName":"","appActivity":".DictDemo","appPackage":"com.youdao.dict"}}
info: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)
info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session fe34d45b-4d40-459b-b734-f7b14350c10c
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.7.0_75
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: [debug] Checking whether adb is present
warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
info: [debug] executing cmd: where adb
info: [debug] Using adb from D:\Android\android-sdk\platform-tools\adb.exeinfo: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: "D:\Android\android-sdk\platform-tools\adb.exe" devices
info: [debug] 1 device(s) connected
info: Found device 8f7581e5
info: [debug] Setting device id to 8f7581e5
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: "D:\Android\android-sdk\platform-tools\adb.exe" -s 8f7581e5 wait-for-device
info: [debug] executing cmd: "D:\Android\android-sdk\platform-tools\adb.exe" -s 8f7581e5 shell "echo 'ready'"
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn ENOENT
info: [debug] Stopping logcat capture
代码:
private static AppiumDriver dr = null;
@BeforeClass
public static void init() throws MalformedURLException{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");//这句不是必须的
capabilities.setCapability("deviceName","8f7581e5");//该手机的 deviceName.请用 adb devices 查询到
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("appPackage", "com.youdao.dict");
capabilities.setCapability("appActivity", ".DictDemo");
dr = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void appTest() throws MalformedURLException, InterruptedException{
dr.findElementByAccessibilityId("DictQueryBox").sendKeys("密码");
Thread.sleep(2000);
dr.findElementByAccessibilityId("DictQueryButton").click();
Thread.sleep(3000);
……
……
}
@AfterClass
public static void destroy(){
dr.quit();
}