微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

pytest-selenium 已安装但不能作为 pytest 的插件使用我做错了什么?

如何解决pytest-selenium 已安装但不能作为 pytest 的插件使用我做错了什么?

我已经安装了 pytest-selenium,但我无法将它与 pytest 一起使用。

  def test_sanity(selenium):
E       fixture 'selenium' not found
>       available fixtures: cache,capfd,capfdbinary,caplog,capsys,capsysbinary,check,cov,dash_br,dash_duo,dash_process_server,dash_thread_server,dashr,dashr_server,doctest_namespace,install_cbm_dash,install_dir,Metadata,mock,mocker,monkeypatch,most_recent_installer_exe,no_cover,pytestconfig,record_property,record_testsuite_property,record_xml_attribute,recwarn,run_installer,tmp_path,tmp_path_factory,tmpdir,tmpdir_factory,uninstall_after_run
>       use 'pytest --fixtures [testpath]' for help on them.

λ pytest --fixtures
======================================================= test session starts ======================================================= platform win32 -- Python 3.6.8,pytest-4.6.3,py-1.8.0,pluggy-0.12.0
rootdir: C:\Users\dbak\Downloads\cmder
plugins: allure-pytest-2.7.0,dash-1.7.0,flaky-3.6.0,check-0.3.5,cov-2.10.0,html-1.21.1,Metadata-1.8.0,mock-1.10.4,profiling-1.7.0

这可能是什么根本原因?我该如何解决

解决方法

这意味着没有名为 */5 * * * * cd /var/www/website_domain; php -q wp-cron.php >/dev/null 2>&1 的夹具。

您可能需要初始化 selenium。您可以在要使用它的每个函数中执行此操作,但这很烦人。因此,更好的选择是在 selenium 中添加一个函数。这样你就可以继续使用 conftest.py 作为测试函数的参数。

selenium

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。