How to take/capture screenshot.
First of all, the AtataContext
should be configured to store screenshots.
Take a look at Getting Started/Set Up/Screenshots.
For example:
AtataContext.GlobalConfiguration
.ScreenshotConsumers.AddFile();
There are few ways to capture a screenshot depending on place where you need to do it.
Use Report.Screenshot(...)
method:
Go.To<OrdinaryPage>()
.Report.Screenshot();
// Report.Screenshot("optional title"); // To pass a title.
AtataContext.Current.TakeScreenshot("optional title");
Use TakeScreenshot trigger. Below are just 2 possible scenarios.
[TakeScreenshot(TriggerEvents.BeforeClick)]
// [TakeScreenshot("optional title", TriggerEvents.BeforeClick)] // To pass a title.
public Button<_> Save { get; private set; }
[TakeScreenshot(TriggerEvents.Init)]
public class SomePage : Page<_>
{
}