Appium appium 无法启动测试

星辰 · 2014年07月18日 · 最后由 jk 回复于 2014年07月25日 · 3025 次阅读

这是网上测试 ContactManager 的例子,一直运行失败,麻烦各位看一下哪位出错了,不知道是什么原因;应该是 capabilities 设置出错了,导致 driver 出错,但我也不知道具体在哪里出错了,求大神帮忙。下面是源码,再往下是日志。

File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "apps/ContactManager");
System.out.println(appDir.getAbsolutePath());
File app = new File(appDir, "ContactManager.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Google Nexus S");
capabilities.setCapability("platformVersion", "4.2");
capabilities.setCapability("appPackage", "com.example.android.contactmanager");
capabilities.setCapability("appActivity", ".ContactManager");
capabilities.setCapability("app", app.getAbsolutePath());
driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

Starting Node Server
info: Welcome to Appium v1.2.0 (REV e53f49c706a25242e66d36685c268b599cc18da5)
ERROR: debug: Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"18","automationName":"Appium"}
info: Appium REST http interface listener started on 127.0.0.1:4723
info: LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.2","app":"E:\ilanlin\workspace\testmv\apps\ContactManager\ContactManager.apk","platformName":"Android","deviceName":"Google Nexus S","appActivity":".ContactManager","appPackage":"com.example.android.contactmanager"}}
ERROR: debug: Appium request initiated at /wd/hub/session
ERROR: debug: Request received with params: {"desiredCapabilities":{"platformVersion":"4.2","app":"E:\ilanlin\workspace\testmv\apps\ContactManager\ContactManager.apk","platformName":"Android","deviceName":"Google Nexus S","appActivity":".ContactManager","appPackage":"com.example.android.contactmanager"}}
info: Starting android appium
ERROR: debug: Using local app from desired caps: E:\ilanlin\workspace\testmv\apps\ContactManager\ContactManager.apk
ERROR: debug: Creating new appium session 44ed797b-dabc-422f-8e4c-a7a867e2e8fa
info: Retrieving device
ERROR: debug: Using fast reset? true
ERROR: debug: Preparing device for session
ERROR: debug: Checking whether app is actually present
ERROR: debug: Checking whether adb is present
ERROR: debug: Using adb from D:\Program Files\android-sdk-windows\platform-tools\adb.exe
ERROR: debug: Trying to find a connected android device
ERROR: debug: Getting connected devices...
ERROR: debug: executing: "D:\Program Files\android-sdk-windows\platform-tools\adb.exe" devices
ERROR: debug: 1 device(s) connected
info: Found device 192.168.56.101:5555
ERROR: debug: Setting device id to 192.168.56.101:5555
ERROR: debug: Waiting for device to be ready and to respond to shell commands (timeout = 5)
ERROR: debug: executing: "D:\Program Files\android-sdk-windows\platform-tools\adb.exe" -s 192.168.56.101:5555 wait-for-device
ERROR: debug: executing: "D:\Program Files\android-sdk-windows\platform-tools\adb.exe" -s 192.168.56.101:5555 shell "echo 'ready'"
ERROR: debug: Starting logcat capture
ERROR: error: Logcat capture failed: spawn ENOENT
ERROR: debug: Stopping logcat capture

共收到 15 条回复 时间 点赞

控制台显示的内容是:
[TestNG] Running:
C:\Users\Administrator\AppData\Local\Temp\testng-eclipse--1685356024\testng-customsuite.xml

E:\ilanlin\workspace\testmv\apps\ContactManager
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

我遇到和楼主同样的问题,分析正常启动和不能正常启动的 Log,不正常的时候,请求的参数少了 sessionid。
不能正常启动,请求参数中没有 sessionid

正常启动的 logo:

3楼 已删除

我的也是这个问题,如何解决呢

http://www.cnblogs.com/liyiran/p/3861245.html

这里的文章指出了一个解决方案

注意:ERROR: error: Logcat capture failed: spawn ENOENT

这个问题我都说过很多遍了。appium 的 sdk 路径里不允许有空格。

路径是 D:\AppiumForWindows-1.0.0\sdk\adt\sdk

#7 楼 @cdheyue 最好将你的报错贴上 你确定你和楼主的报错是一样的吗?

#8 楼 @umbrella1978 上面这个图看不出来吗?

#9 楼 @cdheyue 这是启动后的 log,没有问题啊

#10 楼 @umbrella1978 这里面的 error 不需要管是吧,左边那个图里面的

#12 楼 @umbrella1978 好的,谢谢
中文教程好像被删了,你有吗,发我一个可以吗?
814438165@qq.com

运行模拟器提示 [2014-07-25 14:53:13 - DeviceMonitor] Sending Tracking request failed!,什么原因呢

用 robotframework 写界面自动化测试,如何使用 select checkbox 勾选我想要的复选框?
我的总是报错 ValueError: Element locator 'id=treeDemo_1_check' did not match any elements.

请教给我大侠,什么原因呢?

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册