Appium Apium 测试脚本,应用 APK 文件是不是必须的?如果不需要安装,直接运行机器里已经安装好的应用,要怎么处理?

Hope · 2015年01月04日 · 最后由 Hope 回复于 2015年01月06日 · 2117 次阅读

desired_caps['app'] = PATH('C:\Users\Stephen\Desktop\ContactManager.apk')
是必须的吗?

如果不需要安装,直接运行机器里已经安装好的应用,要怎么处理?

共收到 8 条回复 时间 点赞

我是直接注释掉了这行,你试试

不是必须的。

Hope #3 · 2015年01月04日 Author

注掉不行的,试过了

Hope #4 · 2015年01月05日 Author

会提示错误:

> info: [37m-->[39m [37mPOST[39m [37m/wd/hub/session[39m [90m{"desiredCapabilities":{"device":"Android","version":"4.4","platformName":"Android","deviceName":"Test","app-package":"com.android.contacts","app-activity":"activities.PeopleActivity"}}[39m
> error: No app set; either start appium with --app or pass in an 'app' value in desired capabilities, or set androidPackage to launch pre-existing app on device
> info: [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. : device, version, app-package, app-activity
> error: Failed to start an Appium session, err was: Error: No app set; either start appium with --app or pass in an 'app' value in desired capabilities, or set androidPackage to launch pre-existing app on device
> info: [debug] No appActivity desired capability or server param. Parsing from apk.
Hope #5 · 2015年01月05日 Author

@test_skp @xuxu 有没有参考的脚本,谢谢

Hope #6 · 2015年01月06日 Author

Sample-code 中 “android-simple”,我注掉:

// desired.app = require("./helpers/apps").androidApiDemos;

提示:

> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: No app set; either start appium with --app or pass in an 'app' value in desired capabilities, or set androidPackage to launch pre-existing app on device)","origValue":"No app set; either start appium with --app or pass in an 'app' value in desired capabilities, or set androidPackage to launch pre-existing app on device"},"sessionId":null}

@hopecao or set androidPackage to launch pre-existing app on device! 注释掉后请设置 appPackage,appActivity。非"app-package","app-activity"

Hope #8 · 2015年01月06日 Author

@xuxu 多谢!

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