我使用 selenium python 創建了一些測驗腳本,它們運行良好。但是,當我嘗試生成 html 報告或誘惑報告時遇到了麻煩。
我使用以下命令嘗試生成 pytest html 報告:“pipenv運行 python -mpytest xxx/test_xxxx.py --html=report.html”。但是,我收到以下錯誤:“
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --html=report.html
inifile: None
rootdir: C:\Users\xxxx\xxxx"
. 我已經pytest-html使用 pip install 安裝了插件pytest-html,所以我不確定我做錯了什么。
我嘗試卸載并重新安裝,但沒有奏效。我還嘗試了以下鏈接(其中包括):
- pytest:錯誤:無法識別的引數:--html=report.html
- 使用 pytest 為 selenium python 自動化測驗生成 html 和 json 報告
有沒有人有任何見解?
uj5u.com熱心網友回復:
我想我已經找到了解決方案。因為我使用 pipenv 來運行我的測驗,所以我也必須通過 pipenv 安裝依賴項。所以對于 html 和 allure 報告,完整的命令如下:
pipenv run pip install allure-pytest
pipenv run pip install pytest-html
嘗試此操作后,我運行了以前的命令,并且不再遇到問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/478778.html
標籤:硒网络驱动程序 pytest 引诱 pytest-html
