ModuleNotFoundError:没有名为“appium.webdriver.common.touch_action”的模块

问题描述 投票:0回答:1

当我切换到 Mac 时,我目前正在进行新的设置。我正在尝试在此设备中设置 Python、Robotframework 和 appium。我相信,我已经安装了所需的所有内容并在 .bash_profile 中指定了路径。但是,当我运行任何测试时,我收到以下错误:

[ ERROR ] Error in file '/Users/shettya/nemo-qs/Nemo/GlobalParameters/GlobalKeywords/ErwinLoginAndSelectRoll.robot' on line 2: Importing library 'AppiumLibrary' failed: ModuleNotFoundError: No module named 'appium.webdriver.common.touch_action'

Traceback (most recent call last):
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/AppiumLibrary/__init__.py", line 4, in <module>
    from AppiumLibrary.keywords import *
   File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/AppiumLibrary/keywords/__init__.py", line 9, in <module>
    from ._touch import _TouchKeywords
    File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/AppiumLibrary/keywords/_touch.py", line 3, in <module>
    from appium.webdriver.common.touch_action import TouchAction


PYTHONPATH:
  /Users/shettya/nemo-qs/lib
  /Users/shettya/nemo-qs/resources
  /Users/shettya/.vscode/extensions/d-biehl.robotcode-0.78.4/bundled/libs
  /Users/shettya/.vscode/extensions/d-biehl.robotcode-0.78.4/bundled/tool/robotcode
  /opt/homebrew/anaconda3/lib/python311.zip
  /opt/homebrew/anaconda3/lib/python3.11
  /opt/homebrew/anaconda3/lib/python3.11/lib-dynload
  /opt/homebrew/anaconda3/lib/python3.11/site-packages
  /opt/homebrew/anaconda3/lib/python3.11/site-packages/aeosa

以下是我 pip3 list 时的所有安装:

Package                         Version
------------------------------- -----------
Appium-Python-Client            4.0.0
attrs                           23.2.0
certifi                         2024.2.2
cffi                            1.16.0
charset-normalizer              3.3.2
click                           8.1.7
cryptography                    42.0.5
decorator                       5.1.1
docutils                        0.21
grpcio                          1.62.1
grpcio-tools                    1.62.1
h11                             0.14.0
idna                            3.6
kitchen                         1.2.6
numpy                           1.26.4
opencv-python                   4.9.0.80
outcome                         1.3.0.post0
overrides                       7.7.0
packaging                       24.0
pillow                          10.2.0
pip                             24.0
protobuf                        4.25.3
pycparser                       2.22
PySocks                         1.7.1
pytesseract                     0.3.10
requests                        2.31.0
robotframework                  7.0
robotframework-appiumlibrary    2.0.0
robotframework-archivelibrary   0.4.2
robotframework-assertion-engine 3.0.3
robotframework-browser          18.3.0
robotframework-pythonlibcore    4.4.1
robotframework-requests         0.9.7
robotframework-seleniumlibrary  6.2.0
selenium                        4.19.0
setuptools                      69.2.0
six                             1.16.0
sniffio                         1.3.1
sortedcontainers                2.4.0
trio                            0.25.0
trio-websocket                  0.11.1
typing_extensions               4.11.0
urllib3                         1.26.6
wheel                           0.43.0
wrapt                           1.16.0
wsproto                         1.2.0

此外,.bash_profile 包含 python 和 RF 安装:

export PATH="/opt/homebrew/anaconda3/bin:export:$PATH"

这些安装在 Windows 上运行良好。

请提出建议,我做错了什么以及如何解决这个问题?

非常感谢。

python macos appium robotframework
1个回答
0
投票

我认为自 Appium 2.x 起,触摸操作已被弃用

请参阅此处了解原因以及如何迁移(JAVA 代码):https://www.thegreenreport.blog/articles/the-transition-from-touch-to-w3c-actions-in-selenium/the-transition-from -touch-to-w3c-actions-in-selenium.html

相关帖子(JAVA):Appium TouchAction 类已弃用,点击坐标

© www.soinside.com 2019 - 2024. All rights reserved.