Require file path of the ReportFullPageScreenshot library

Ask general questions here.
akhil.pokala
Posts: 22
Joined: Fri Jun 04, 2021 4:53 pm

Require file path of the ReportFullPageScreenshot library

Post by akhil.pokala » Thu Sep 23, 2021 9:31 am

Hi,

I have been using ReportFullPageScreenshot library and able to capture the full page screenshot as expected. But I need to know where this .png file is being saved to perform some operations.

For example , Text file libraries will be saved to "Output" folder. Similarly I need the file path of this screenshot file. Below is the user code.

Could you please help at the earliest.

# Code

public static void ReportFullPageScreenshot(RepoItemInfo repoItemInfo)
{
ProgressForm.Hide();

try
{
Utils.CheckArgumentNotNull(repoItemInfo, "repoItemInfo");

var webDocument = repoItemInfo.CreateAdapter<WebDocument>(false);

if (webDocument == null)
{
Report.Error("Repository item '" + repoItemInfo.FullName + "' is not a web document. " +
"Screenshot can be taken only for web documents.");
return;
}

var screenshotFilePath = Path.GetTempFileName();

var screenshot = webDocument.CaptureFullPageScreenshot();
screenshot.Save(screenshotFilePath);

Report.LogData(ReportLevel.Info, "Screenshot", screenshot);

if (File.Exists(screenshotFilePath))
{
try
{
File.Delete(screenshotFilePath);
}
catch
{
// No need to handle exception.
// Temp files are deleted only to prevent piling up of unnecessary files.
}
}
}
catch (Exception ex)
{
Utils.ReportException(ex, libraryName);
}

ProgressForm.Show();
}

Jacob
Certified Professional
Certified Professional
Posts: 120
Joined: Mon Mar 22, 2021 10:01 pm

Re: Require file path of the ReportFullPageScreenshot library

Post by Jacob » Thu Sep 23, 2021 8:10 pm

Hi Akhil.pokala,

By default, images are stored in "\<ProjectName>\bin\Debug\Reports\images_<TestSuiteName>_<8 character Hex string>"
I hope this helps!

--Jacob
Image

akhil.pokala
Posts: 22
Joined: Fri Jun 04, 2021 4:53 pm

Re: Require file path of the ReportFullPageScreenshot library

Post by akhil.pokala » Mon Oct 18, 2021 9:20 am

Thanks Jacob .