Extent Report File name | Selenium C# Forum
V
Vrushali Posted on 23/03/2019

Why ExtentReport NOT displaying current Date time to html file ...instead why it is taking index.html name.

WHAT'S WRONG IN MY CODE

 

public static ExtentReports getInstance()
{
if (extent == null)
{
string reportFile = DateTime.Now.ToString().Replace("-", "_").Replace(":", "_").Replace(" ", "_") + ".html";
htmlReporter = new ExtentHtmlReporter(@"C:\BNSF_Automation\Extent_Reports\" + reportFile);
extent = new ExtentReports();
extent.AttachReporter(htmlReporter);
extent.AddSystemInfo("OS", "Windows");
extent.AddSystemInfo("Host Name", "vrhaldan");
extent.AddSystemInfo("Environment", "QA");
extent.AddSystemInfo("UserName", "vrhaldan");
Console.WriteLine(DateTime.Now.ToString());
Console.WriteLine(DateTime.Now.ToString().Replace("-", "_").Replace(":", "_").Replace(" ", "_"));

htmlReporter.LoadConfig(@"C:\Users\vrhaldan\documents\visual studio 2015\Projects\Sample_Extent_Report\Sample_Extent_Report\extent-config.xml");
}
return extent;
}


G
gunjan Replied on 23/03/2019

Please share the zip file of the complete code.


A
Anuja Replied on 04/02/2022

Hello,

 

I am also having the same issue. My code is exactly same as above. Please help.

 

Thanks,

Anuja