我正在捕获失败时的屏幕截图,并且范围报告会显示它。当我在范围报告中单击捕获的屏幕截图时,它不是全屏。它的四边短约 1 厘米。
如何增强它以使其全屏?
我正在捕获失败时的屏幕截图,并且范围报告会显示它。当我在范围报告中单击捕获的屏幕截图时,它不是全屏。它的四边短约 1 厘米。
如何增强它以使其全屏?
您可以在 extent-config.xml 中更改 css 样式配置。下面的例子,改变了图像的宽度。
<!-- custom styles -->
<styles>
<![CDATA[
.featherlight-image { border: 1px solid #f6f7fa; cursor: zoom-in; width: 75px; }
]]>
</styles>
检查报告中的 css 变量并根据需要调整图像。
对于范围报告 v4,您可以使用 htmlReporter
public ExtentHtmlReporter htmlReporter;
@BeforeTest
public void setExtentReport() {
String reportUrl = System.getProperty("user.dir") + "/test-output/ExtentReportVersion4.html";
htmlReporter = new ExtentHtmlReporter(reportUrl);
String css = ".r-img {width: 100%;}";
htmlReporter.config().setCSS(css);
}