如何解决报错:“ModuleNotFoundError: No module named ‘appium.webdriver.common.appiumby’”
易瘦易胖 2024-06-14 13:33:02 阅读 93
如何解决报错:“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,完美解决。
上一篇: 程序员接私活必备的10款开源前端后台框架,学习网页web前端开发
下一篇: Langchain 流式输出到前端(真正解决方法,附最佳实践的完整代码)
本文标签
如何解决报错:“ModuleNotFoundError: No module named ‘appium.webdriver.common.appiumby’”
声明
本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。