Appium 请教,运行脚本后,出现 Command failed 的错误。

ma · 2014年09月02日 · 最后由 恒温 回复于 2014年09月02日 · 3902 次阅读
import os
from selenium import webdriver

PATH = lambda p: os.path.abspath(
    os.path.join(os.path.dirname(__file__), p)
)

desired_caps = {}
desired_caps['deviceName'] = '6TZPJZGEAUK7TOWG'
desired_caps['platformName'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.2'
#desired_caps['app'] = PATH(r'C:\Users\mazhigang\Desktop\AndroidStorm.apk')
desired_caps['appPackage'] = 'com.storm.smart'
desired_caps['appActivity'] = '.LogoActivity'

driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)

上面是代码,就写了这么多,然后 python XXX.py 运行,appium 上报错信息;

error: Failed to start an Appium session, err was: Error: Command failed:
debug: Error: Command failed:
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)
debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: )","killed":false,"code":1,"signal":null,"origValue":"Command failed: "},"sessionId":null}

不知道这个 Command failed 是怎么错了。求大神指点。

共收到 14 条回复 时间 点赞

version 应该是 platformVersion 吧,不知道是不是这个导致的

ma #2 · 2014年09月02日 Author

#1 楼 @cy_suncheng 我改成 platformVersion,还是这个错误

@test_skp desired_caps['deviceName'] = '2013022' , 2013022 是啥?

ma #5 · 2014年09月02日 Author

#3 楼 @lihuazhang 从手机设置->关于手机->型号,这里看到的。

不应该这样看 你用 adb devices -l 看看

加个头像

ma #7 · 2014年09月02日 Author

#5 楼 @lihuazhang deviceName 已经改成用 adb devices 查看的了。但是错误依旧。头像加了。实在不行,我重新搭环境了。

#7 楼 @test_skp 你试过把 app 的路径写上么

ma #9 · 2014年09月02日 Author

#8 楼 @cy_suncheng 试过,写上会装这个 app,但是还是有这个问题。

#9 楼 @test_skp 你的意思是安装完了,那启动了么?

建议将你改完的代码再贴出来

ma #12 · 2014年09月02日 Author

#10 楼 @cy_suncheng 没启动,装完应用,就还是这个 command failed,这个错误。
#11 楼 @umbrella1978 我就该了一下 deviceName 得值,其他没动。

ma #13 · 2014年09月02日 Author

这里还有一个问题啊,appium 往手机里装应用,会重新给应用打签名吗?应该我看会改变我电脑上应用的 md5

#13 楼 @test_skp 会的。nosign 默认是 false 的

if (this.args.noSign) {
logger.debug('noSign capability set to true, skipping checking and signing of app');
afterSigning();
} else {
this.adb.checkAndSignApk(this.args.app, this.args.appPackage, afterSigning);
}
};

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