【问题标题】:Unable to run pytest command using .bat file but same command is ok in pytest terminal无法使用 .bat 文件运行 pytest 命令,但在 pytest 终端中可以使用相同的命令
【发布时间】:2021-12-23 15:55:46
【问题描述】:

我在 pytest 终端中使用这个命令,它运行良好: pytest -v -s -m "sanity or regression or functional" --html=./Reports/report.html testCases/ --browser chrome - -capture=tee-sys

但是当我保存到 .bat 文件并以管理员身份运行时,同样的命令给出了无法导入 wedriver_manager 的错误。

附加两个快照。

run.bat - 不行

pycharm 终端 - 好的

【问题讨论】:

    标签: python-3.x batch-file selenium-webdriver automated-tests pytest


    【解决方案1】:

    可能需要看代码。但是,您可以尝试将--capture=tee-sys 更改为--capture=sys,尽管我认为这与webdriver-manager 无关。 另外,您使用的是虚拟环境还是原生环境?

    【讨论】:

    • 感谢您放弃回答!通常,在堆栈溢出时。请保留对帖子 cmets 提出问题的回复。很高兴有你在这里!
    猜你喜欢
    • 2018-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-28
    • 2020-11-27
    相关资源
    最近更新 更多