python+playwright 学习-80 v1.37版本新增--full-page-screenshot 用例失败截长图

上海-悠悠 / 2023-08-29 / 原文

前言

--full-page-screenshot参数是pytest-playwright在使用,在失败时是否进行完整页面截图。默认情况下,仅捕获视口。
需开启 --screenshot 开关 (默认: off).

用例失败截图

环境准备:
1.安装playwright最新v1.37版本
2.安装pytest-playwright 0.4.2 版本

用例示例


运行用例

pytest a_playw --headed --screenshot=on

用例失败截图,默认仅截图当前可视窗口

用例失败截取长图

带上--full-page-screenshot参数 执行用例

pytest a_playw --headed --screenshot=on --full-page-screenshot

用例失败时截图长图