在执行python代码过程中,出现了以下错误:
错误一:No module named 'appium.webdriver.common.touch_action
Traceback (most recent call last):
File "d:\xxx\index.py", line 3, in
ModuleNotFoundError: No module named 'appium.webdriver.common.touch_action'
错误二:AttributeError: 'NoneType' object has no attribute 'to_capabilities'
File "E:\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 188, in __init__
capabilities = options.to_capabilities()
AttributeError: 'NoneType' object has no attribute 'to_capabilities'
此类问题的产生是由于安装的Appium-Python-Client与Selenium版本不兼容导致。
pip install Appium-Python-Client
默认安装的是最新版的Appium-Python-Client(本文安装时的版本是4.0.0),可用pip show 包名
命令查看:
由于Appium-Python-Client版本过高,须要降低版本使用,建议使用 Appium-Python-Client: 2.11.0
解决此类问题。可执行以下命令:
pip install Appium-Python-Client==2.11.0