我是靠谱客的博主 醉熏唇彩,最近开发中收集的这篇文章主要介绍python+appium自动化测试遇到的一些坑及问题总结(三),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Issue 21: 手机模拟滑动屏幕, 使用driver.get_window_size()会报错,提示selenium.common.exceptions.WebDriverException: Message: The URL ‘/wd/hub/session/2763af95-8c0c-4533-8b73-0eae25e5a026/window/size’ did not map to a valid resource

Solution:
源码路径:python-pathLibsite-packagesseleniumwebdriverremoteremote_connection.py (353行)

修改selenium源码变更get_window_size的请求路径为:
Command.W3C_GET_WINDOW_SIZE: (‘GET’, ‘/session/ s e s s i o n I d / w i n d o w / sessionId/window/ sessionId/window/windowHandle/size’),

参考:https://testerhome.com/topics/16435

Issue 22: 如何查看appium库的文档:

python -m pydoc -p 4567

Issue 23: uiautomatorviewer截图报错:Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn’t exist!

在这里插入图片描述

Solution: 关掉appium

24. Appium-doctor报错:Why opencv4nodejs is needed and how to install it

info AppiumDoctor ### Optional Manual Fixes ###
info AppiumDoctor The configuration can install optionally. Please do the follow
ing manually:
WARN AppiumDoctor ➜ Why opencv4nodejs is needed and how to install it: https://
github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-compar
ison.md
WARN AppiumDoctor ➜ ffmpeg is needed to record screen features. Please read htt
ps://www.ffmpeg.org/ to install it
WARN AppiumDoctor ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP fe
atures. Please install it with ‘npm i -g mjpeg-consumer’.
WARN AppiumDoctor ➜ bundletool.jar is used to handle Android App Bundle. Please
read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/
to install it. Also consider adding the “.jar” extension into your PATHEXT envi
ronment variable in order to fix the problem for Windows
WARN AppiumDoctor ➜ gst-launch-1.0.exe and gst-inspect-1.0.exe are used to stre
am the screen of the device under test. Please read https://appium.io/docs/en/wr
iting-running-appium/android/android-screen-streaming/ to install them and for m
ore details
info AppiumDoctor

solution:
直接下载cmake,然后配置环境变量。cmake -version有效后,执行npm -g install opencv4nodejs就可以了,亲测有效

25. 下载cmake非常慢,导致最后下载失败

Solution:
用迅雷下载,还是快多了,终于下载成功了

26. An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up

Solution:
case中加了sleep后,可能会报这个错。
查看appium server log中有该打印:
Shutting down because we waited 60 seconds for a command
Closing session, cause was 'New Command Timeout of 60 seconds expired. Try customizing the timeout using the

Appium在没有收到下一个命令时,默认超时时间是60s,超时后应用将会自动关闭session,所以你接下来的所有操作都将失败。(Android和iOS通用)
capabilities = {
‘automationName’: ‘UIAutomator2’,
#可以通过newcommandtimeout将超时时间改长,这样就解决了该问题!!
#超时时间可按照实际情况自定义!
‘newCommandTimeout’: “2000”,

‘unicodeKeyboard’: True,
‘resetKeyboard’: True,
‘noSign’: True
}
host = “http://localhost:4723/wd/hub”
driver = webdriver.Remote(host, capabilities)

  1. Android SDK Manager下载android R失败,报错:URL not found xxxxx(Acess is denied)
    解决方法:
    用管理员身份运行SDK Manager.exe

最后

以上就是醉熏唇彩为你收集整理的python+appium自动化测试遇到的一些坑及问题总结(三)的全部内容,希望文章能够帮你解决python+appium自动化测试遇到的一些坑及问题总结(三)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部