当前位置:   article > 正文

如何解决报错:“ModuleNotFoundError: No module named ‘appium.webdriver.common.appiumby’”_modulenotfounderror: no module named 'appium

modulenotfounderror: no module named 'appium

如何解决报错:“ModuleNotFoundError: No module named ‘appium.webdriver.common.appiumby’”


问题描述

from appium.webdriver.common.appiumby import AppiumBy
导入AppiumBy,启动脚本,会一直报错:
“ModuleNotFoundError: No module named ‘appium.webdriver.common.appiumby’”

报错信息如下:

demo1.py:None (demo1.py)
ImportError while importing test module ‘/Users/zxmac/PycharmProjects/pythonProject1/demo1.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_pytest/python.py:608: in _importtestmodule
mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_pytest/pathlib.py:533: in import_path
importlib.import_module(module_name)
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
exec(co, module.dict)
demo1.py:6: in
from appium.webdriver.common.appiumby import AppiumBy
E ModuleNotFoundError: No module named ‘appium.webdriver.common.appiumby’

原因分析:

尝试了设置pytest.ini和conftest.py都无法解决,网上各种方法都试了也不管用
(ImportError while importing test module ‘/Users/zxmac/PycharmProjects/pythonProject1/demo1.py’.
Hint: make sure your test modules/packages have valid Python names.)
后来针对这两个报错提示信息,找到了解决办法,原来是Appium-Python-Client和selenium版本冲突导致。

解决方案:

报错时,Appium-Python-Client版本是1.2.0,selenium版本是3.141.0,把Appium-Python-Client版本升级到2.7.1,selenium版本升级到4.1,完美解决。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/893141
推荐阅读
相关标签
  

闽ICP备14008679号