运行appium代码报错

appiumd桌面版和网页版已经配置好所有环境,课堂老师的代码运行还是会报错!求解,谢谢!image|800x368

把完整的错误信息贴出来

D:\W10\python3.9\python.exe “D:\W10\PyCharm Community Edition 2021.2\plugins\python-ce\helpers\pycharm_jb_pytest_runner.py” --path “D:/Workrs10/ Test_Development/day05/demo01/test_demo.py”
Testing started at 1:11 …
Launching pytest with arguments D:/Workrs10/ Test_Development/day05/demo01/test_demo.py --no-header --no-summary -q in D:\Workrs10\ Test_Development\day05

Traceback (most recent call last):
File “D:\W10\PyCharm Community Edition 2021.2\plugins\python-ce\helpers\pycharm_jb_pytest_runner.py”, line 51, in
sys.exit(pytest.main(args, plugins_to_load + [Plugin]))
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init_.py”, line 143, in main
config = prepareconfig(args, plugins)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 318, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\hooks.py”, line 286, in call
return self._hookexec(self, self.get_hookimpls(), kwargs)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 84, in
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 203, in multicall
gen.send(outcome)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\helpconfig.py”, line 100, in pytest_cmdline_parse
config: Config = outcome.get_result()
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 80, in get_result
raise ex[1].with_traceback(ex[2])
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 187, in multicall
res = hook_impl.function(*args)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 1003, in pytest_cmdline_parse
self.parse(args)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 1283, in parse
self.preparse(args, addopts=addopts)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 1172, in preparse
self.pluginmanager.load_setuptools_entrypoints(“pytest11”)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 300, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 436, in register
ret: Optional[str] = super().register(plugin, name)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 127, in register
hook._maybe_apply_history(hookimpl)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\hooks.py”, line 333, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 84, in
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 208, in _multicall
return outcome.get_result()
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 80, in get_result
raise ex[1].with_traceback(ex[2])
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 187, in _multicall
res = hook_impl.function(*args)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\allure_pytest\plugin.py”, line 48, in pytest_addoption
severities = [x.value for x in list(allure.severity_level)]
AttributeError: module ‘allure’ has no attribute ‘severity_level’

Process finished with exit code 1

Empty suite
老师,请教一下:这些报错,应该怎么去查找分析,可以更快的找到问题点呢?重新检查了所有配置环境,都没有问题!这些报错还是没有看懂

看上去就是感觉缺少文件,对象和方法 :sleepy:,一时无从下手 :sob:

看关键的报错就行了,这句话说对象没有方法,估计是跟你的安装的allure的版本有关系。

老师,再次请教一下:这个问题说缺了一个’allure‘包
Traceback (most recent call last):
File “C:\Program Files\JetBrains\PyCharm Community Edition 2021.3\plugins\python-ce\helpers\pycharm_jb_pytest_runner.py”, line 51, in
sys.exit(pytest.main(args, plugins_to_load + [Plugin]))
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init_.py”, line 143, in main
config = prepareconfig(args, plugins)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 318, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\hooks.py”, line 286, in call
return self._hookexec(self, self.get_hookimpls(), kwargs)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 84, in
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 203, in multicall
gen.send(outcome)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\helpconfig.py”, line 100, in pytest_cmdline_parse
config: Config = outcome.get_result()
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 80, in get_result
raise ex[1].with_traceback(ex[2])
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\callers.py”, line 187, in multicall
res = hook_impl.function(*args)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 1003, in pytest_cmdline_parse
self.parse(args)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 1283, in parse
self.preparse(args, addopts=addopts)
File "C:\Users\asus\AppData\Roaming\Python\Python39\site-packages_pytest\config_init
.py", line 1172, in preparse
self.pluginmanager.load_setuptools_entrypoints(“pytest11”)
File “C:\Users\asus\AppData\Roaming\Python\Python39\site-packages\pluggy\manager.py”, line 299, in load_setuptools_entrypoints
plugin = ep.load()
File “D:\W10\python3.9\lib\importlib\metadata.py”, line 77, in load
module = import_module(match.group(‘module’))
File "D:\W10\python3.9\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1030, in _gcd_import
File “”, line 1007, in _find_and_load
File “”, line 981, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘allure.pytest_plugin’; ‘allure’ is not a package

本以为是版本问题,又更新2.9版本,pytest -allure后来重新卸载又安装了,而且‘pip install pytest -allure’命令安装不了,只能在库里面安装!我都装allure包还是报一样的错,请问一下,有什么解决方法嘛?

升级一下pip,然后卸载原有版本,安装

pip3 install pytest-allure-adaptor
pip3 instal allure-pytest

collecting …
demo01/test_demo.py:None (demo01/test_demo.py)
demo01\test_demo.py:14: in
driver=webdriver.Remote(‘http://localhost:4723/wd/hpip install --user pytest-allure-adaptorub’,desired_caps)
D:\W10\python3.9\lib\site-packages\appium\webdriver\webdriver.py:273: in init
super().init(
D:\W10\python3.9\lib\site-packages\selenium\webdriver\remote\webdriver.py:266: in init
self.start_session(capabilities, browser_profile)
D:\W10\python3.9\lib\site-packages\appium\webdriver\webdriver.py:364: in start_session
response = self.execute(RemoteCommand.NEW_SESSION, parameters)
D:\W10\python3.9\lib\site-packages\selenium\webdriver\remote\webdriver.py:418: in execute
self.error_handler.check_response(response)
D:\W10\python3.9\lib\site-packages\selenium\webdriver\remote\errorhandler.py:243: in check_response
raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

collected 0 items / 1 error
image
还是报错了 :sob:,有什么解决办法

参考: (49条消息) appium错误: a request was received using an HTTP method that is not supported by the mapped resource_城市的柏油路太硬的博客-CSDN博客

老师,请问一下:这个状态是不是已经说明可以运行成功了呀?


找了几天才发现错了几步!第一,是我在打开模拟器时候没有进行手动连接 :sob: ;第二,代码中之前更换了模拟器一个端口没有改回来

并没有运行成功,这个是提示没有找到测试用例

还是没有找到是哪里的问题,请老师指教

关闭