赞
踩
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,完美解决。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。