【小白成长日常】python+appuim+真机自动化测试遇到的问题总结

编程入门 行业动态 更新时间:2024-10-24 15:16:05

打印出来的 contexts如下
[‘NATIVE_APP’, ‘WEBVIEW_unknown’]
(我跑了一遍切入webview和切出,然后分别出现以下1.2.3.4的报错,看错误提示,具体问题具体百度,哈哈哈哈)

看报错信息中显示 appium 中没装chrome driver
解决办法:blogs./my_captain/p/12796590.html
blog.csdn.net/qq_32722729/article/details/103201616
chrome driver下载
npm.taobao./mirrors/chromedriver

报错信息:

selenium.mon.exceptions.WebDriverException: Message: An unknown server-side error ourred while processing the mand.Original error: An unknown server-side error ourred while processing the mand. Original error: unknown error: Failed to forward ports to device xxxx. No port chosen: . Perhaps your adb version is out of date.ChromeDriver 2.39 and newer require adb version 1.0.38 or newer. Run 'adb version' in your terminal of the host device to find your version of adb.

chromeDriver2.39的版本要求adb1.0.38以上的版本
解决办法:更新adb。去android官网下载platform-tools的最新版本包(要翻墙)
我的之前是version 1.0.31,现在是version 1.0.41
链接:pan.baidu./s/1JjpZio1A1PIuSs6jo_uE5g
提取码:nivs
更新adb的方式:
(1)打开任务管理器,找到adb.exe,右键打开文件所在文件夹

(2)在下载好的新版本的adb中找到这三个文件,复制

(3)到旧版本所在目录替换以下三个文件(以下是旧版本所在的目录)

报错信息:
Message: An unknown server-side error ourred while processing the mand. 
Original error: Error executing adbExec. 
Original error: 'Command 'E:\\adt-bundle-windows\\sdk\\platform-tools\\adb.exe -P 5037 -s xxxxx shell settings delete global hidden_api_policy_pre_p_apps' exited with code 255'; 
Stderr: 'Exception ourred while executing 'delete':
java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS`

手机权限的问题
解决办法:OPPO设备: 开发者选项 - 禁止权限监控 - 开启
小米/红米类手机:设置 - 更多设置 - 开发者选项 - USB调试(安全设置)- 开启
(这个真的是坑到不行,搞了好久)

报错信息:
selenium.mon.exceptions.WebDriverException: Message: An unknown server-side error ourred while processing the mand. 
Original error: Unable to automate Chrome version because it is too old for this version of Chromedriver.
Chrome version on the device: Chrome/83.0.4103.106

chrome driver的版本太旧了
解决办法:参考第2个的解决办法更换适合的chrome driver

报错信息:
selenium.mon.exceptions.ElementNotInteractableException: Message: element not interactable: element has zero size(Session info: chrome=83.0.4103.106)

元素不可交互的问题
解决办法:检查写的xpath(我写的xpath定位不准确)

报错信息:
executing adbExec
selenium.mon.exceptions.WebDriverException: Message: An unknown server-side error ourred while processing the mand. 
Original error: Error getting device platform version. Original error: Error executing adbExec.
Original error: 'Command 'E:\\adt-bundle-windows\\sdk\\platform-tools\\adb.exe -P 5037 -s xxxxxx(手机设备号) shell getprop ro.build.version.release' timed out after 200000ms'. 
Try to increase the 200000ms adb execution timeout represented by 'adbExecTimeout' capability

在usb调试里,把OEM解锁权限打开,因为如果不给权限,它会把appium脚本阻挡在外,不给安装入手机,因为appium就是靠代码来控制手机里面注入的appium脚本(可以理解为木马),来实现自动控制,不安装根本跑不了,所以它会报执行错误,Error executing。
解决办法:检查手机开发者模式中的OEM开启了没,如果还不行,重启电脑或者手机

(吐血了,浪费了好多时间!!!!!!)

更多推荐

日常,测试,白成,appuim,python

本文发布于:2023-05-27 02:41:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/285769.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日常   测试   白成   appuim   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!