在 extent-report 版本 - 4.0.3.0 中,在记录带有屏幕截图的消息时,屏幕截图尺寸显示较小,用于报告中的测试步骤

In extent-report version - 4.0.3.0 , screenshot size is displayed small while logging message with screenshot for test step in report

我正在生成版本 4.0.3.0 的范围报告,其中我在报告中记录测试步骤,其中包含带有屏幕截图的 pass/fail 消息。 生成报告后,对于各个测试步骤 --> 屏幕截图图像显示得很小,无法正常显示。 ChromeBrower:屏幕截图以小尺寸显示。 IEBrowser : 测试步骤不显示屏幕截图。

请帮助我解决在报告中调整屏幕截图大小并使屏幕截图在 IE 浏览器中可见的解决方案。

下面是使用的代码:

public class MerlinBase : Base
    {
        #region Variables

        public string commonDirectoryPath = AppDomain.CurrentDomain.BaseDirectory;
        public string applicationConfigurationPath = AppDomain.CurrentDomain.BaseDirectory + "\TestData\ApplicationConfigurations.xlsx";
        public static ExtentReports extentReports;
        public static ExtentTest extentTest;

        #endregion Variables

        #region Methods

        /// <summary>
        /// This method runs before start of each test 
        /// </summary>
        [SetUp]
        public void TestInitialize()
        {
            DataTable appDetails = ExcelUtilities.ReadExcel(applicationConfigurationPath, "ApplicationDetails");
            string browserType = appDetails.Rows[0]["Browser"].ToString().Trim();
            string appURL = appDetails.Rows[0]["URL"].ToString().Trim();

            BrowserHandler.LaunchBrowser(browserType, commonDirectoryPath);
            BrowserHandler.DeleteCookies();
            BrowserHandler.NavigateToUrl(appURL); 
            BrowserHandler.MaximizeWindow();

            string TestCaseName = TestContext.CurrentContext.Test.MethodName;
            childDirectoryInfo.CreateSubdirectory(TestCaseName);

            extentReports = new ExtentReports();
            extentTest = extentReports.CreateTest(TestCaseName);
            string pathToSaveExtentReport = reportParentFolderPath + "\" + reportChildFolderPath;
            ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(pathToSaveExtentReport +"\"+"AutomationReport"+".html");

            extentReports.AttachReporter(htmlReporter);


        }
public static class ExtentReporting
    {
        static string Screenshot = null;
        public static void Success(this ExtentTest Test, string PassDetails, MediaEntityModelProvider provider = null)
        {
            try
            {
                Screenshot = TakeScreenshot.ScreenshotOfTestStep();
                if (Screenshot != null)
                {
                   var m = MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot).Build();
                    Test.Pass(PassDetails , m);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }

我在 IE 浏览器上打开 Extent 报告时遇到了这个问题,所以 IE 浏览器存在这个问题。 但是在 chrome 中打开时尺寸很小,但更新了分辨率。

htmlReporter.Config.CSS = ".r-img { width: 30%; }";