Original error: The desired capabilities must include either an app, appPackage or browserName

网友投稿 744 2022-11-19

Original error: The desired capabilities must include either an app, appPackage or browserName

Original error: The desired capabilities must include either an app, appPackage or browserName

问题

用Appium测试报错

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while

解决

没有找对对应的​​appPackage​​​和​​appActivity​​​。 可以通过cmd运行下面命令:

adb shell dumpsys window w | find "/" | find "name="

就会得到类似下面的信息:

mSurface=Surface(name=com.tencent.mm/com.tencent.mm.plugin.account.ui.LoginPasswordUI)

其中​​appPackage​​​是​​com.tencent.mm​​​,​​​appActivity​​​是​​com.tencent.mm.plugin.account.ui.LoginPasswordUI​​。

完整代码

python代码

from appium import webdriverdesired_caps = {}desired_caps['platformName'] = 'Android'desired_caps['platformVersion'] = '8.0'desired_caps['deviceName'] = 'DU3ADH14C4009842'# desired_caps['app'] = 'com.iqilu.cloud.MyApplication'desired_caps['appPackage'] = 'com.tencent.mm'desired_caps['appActivity'] = 'com.tencent.mm.plugin.account.ui.LoginPasswordUI'driver = webdriver.Remote('desired_caps)

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Appium服务器初始化参数(Capability)
下一篇:Python3 获取绝对路径
相关文章

 发表评论

暂时没有评论,来抢沙发吧~