ExtentReport is not saving with the file name I provided,instead is taking index.html name. | Selenium C# Forum
A
Anuja Posted on 04/02/2022

Here is my code:

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

 

string filePath=Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory);

filePath=Directory.GetParent(Directory.GetParent(filePath).FullName).FullName;

htmlReporter.LoadConfig(filePath + "\\extent-config.xml");
}
return extent;
}