python accessibilityservice_python+appium自动化测试遇到的一些坑及问题总结(一)

Issue 1: C:\Python36\lib\unittest\case.py:633: ResourceWarning: unclosed

Solution:

https://www.cnblogs.com/cherry-ning/articles/11187673.html

issue 2: UiAutomator quit before it successfully launched

solution:

从appium的日志找到错误: UiAutomationService android.accessibilityservice.IAccessibilityServiceClientS t u b StubStubProxy@6ac370ealready registered!

https://wenda.jikexueyuan.com/question/25363/

停止uiautomator的方法:

1、查询uiautomator进程 windows系统方式 adb shell ps | find “uiautomator”

2、结束进程 第一步查询出pid,然后运行 adb shell kill

issue 3: uiautomator,capture screen, 报错:Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn’t exist!

Solution:

多重启几次app

Issue 4: 使用appium在android7.0真机上测试程序时报错command failed shell "ps ‘uiautomator’"的解决方式

solution:

https://blog.csdn.net/pjl6523853/article/details/72886048

用solution 2解决

issue 5: Appium报错Requested a new session but one was in progress

solution:

solution1: 加上driver.quit()

solution2:

重新停止appium服务,开启Appium服务

在Genarel Setting那里设置覆盖Session,重启Appium

issue 6: adb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\unicode_ime_apk\UnicodeIME-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.android.ime without first uninstalling.]

solution:

https://www.cnblogs.com/syw20170419/p/8289056.html

笨办法:手机输入法设置成appium输入法,注释掉代码中的设置

#desired_caps[‘unicodeKeyboard’] = ‘true’

Issue 7: File “C:\Python36\lib\site-packages\HTMLTestRunner.py”, line 766, in _generate_report_test uo = o.decode(‘latin-1’)AttributeError: ‘str’ object has no attribute ‘decode’

Solution:

HTMLTestRunner.py是从Python2版本由2to3.py自动转换的,修改HTMLTestRunner.py:

uo = o.decode(‘latin-1’) -> uo = o

ue = e.decode(‘latin-1’) -> ue = e

issue 8: [WinError 10061] No connection could be made because the target machine actively refused it

ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

solution:

因为忘记启动Appium, 启动后就OK了

issue 9: 验证码输入框一个一个输有时候不行,光标乱定位

Solution:

一次性输入4个数字

verificationCode_xpath = ‘//*[@resource-id=“com.example.jobAndroid:id/vc_code”]/android.widget.EditText[contains(@index,3)]’

driver.find_element_by_xpath(verificationCode_xpath).send_keys(“1”, “1”, “1”, “1”)

Issue 10: License for package Android SDK Build-Tools 29.0.2not accepted

Solution:

https://blog.csdn.net/qq_34344752/article/details/104974801

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>