立志踩遍所有的坑。。。以下是学appium遇到的坑以及解决方案,方便自己的同时,也方便他人。
一.cmd输入:aapt dump badging C:UsersXXDesktopxxx.apk 会提示dump failed because no androidManifest.xml found
原因分析:apk文件的路径太深。。。
2个解决方案:
- 把apk文件放到短路径文件夹
- 先cd C:UsersXXDesktop,然后执行aapt dump badging xxx.apk -- 获取 apk的appPackage和appActivity
二、运行pycharm中的appiumDemo.py时,出现:A new session could not be created. Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
解决方案:修改appium中的Android Settings
PS:apk文件的路径一定要选对,切记,切记,切记!!!重要的事情说三遍!!!
三、Pycharm中使用from appium import webdriver时报错:ModuleNotFoundError: No module named 'appium'
原因分析:没有安装Appium-Python-Client或者没有在Pycharm中配置Project Interpreter
解决方案:https://www.cnblogs.com/HuangXiaoJuan/p/9548409.html --静看大神的操作
四、运行pycharm中的appiumDemo.py时,出现:Message: A new session could not be created. (Original error: Requested a new session but one was in progress)
原因分析:appium server正在处理上一个session
2个解决方案:
- 关掉你的appium,然后重新打开,接着重新运行脚本appiumDemo.py
-
打开appium的General Settings -->选中Overide Existing Session,接着重新运行脚本appiumDemo.py
四、运行脚本,报错:urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0337E610>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。'))
原因分析:apk文件改名,忘记在appium里面重新choose
解决方案:重新choose
参考链接:https://www.cnblogs.com/du-hong/p/11022247.html
https://www.cnblogs.com/syw20170419/p/7049450.html?utm_source=itdadao&utm_medium=referral