运行appium测试报错 “error: Failed to start an Appium session, err was: Error: Activity used to start app doesn’t exist or cannot ve launched! Make usre it exists and is launchable activity”
appium Activity used to start app doesn't exist or cannot be launched 问题解决?
-
最佳答案
- #1
相关推荐
- Appium iOS WebDriverAgent安装时注意(解决appium 报错code 65 问题)
- Appium TS1 - Command failed: error: cannot bind to socket
- Appium A new session could not be created. (Original error: Instruments crashed on startup 问题?
- Appium几个坑的解决经验分享
- Appium 通过INSPECTOR,发现有多个元素的名字都是一样的怎么办?
- error: Failed to start an Appium session, err was: Error: Command failed: dyld: Library not loaded ?
- Appium switch_to.context测试,老是报错,没有context这个attribute问题?
- 怎么启动APPIUM,以保证它与APPIUM SERVER通信?
一呆瓜(回复于:2018-03-30 07:03:16)
网上很多说法是:“要打开的activity不存在,activity路径错误,改为完整正确的activity路径”
仔细检查了好几遍发现,activity是存在的,activity路径也是正确的(当然这么低端的问题一般人也不会犯)
经过一番查找,问题解决如下:
注释掉setup中的如下两行:
capabilities.setCapability("appPackage", "xxx.xxx.xxx.activity");
capabilities.setCapability("appActivity", ".MainActivity");
再次运行,问题解决了。
说明:说明运行测试的时候我们不需要指定package和activity 这些信息,Appium会从apk中提取这些信息。
见:https://github.com/appium/appium/issues/2981 中paymand 的解释:
Don't know about the apk info tool above, but you can always get that info using the aapt tool from Android SDK with the following command:
adt/sdk/build-tools/android-4.4/aapt dump badging app.apk
Note: You shouldn't need to specify appPackage, appActivity, etc. since Appium should be able to extract those from the apk using the method above anyway.