How do I capture only one screenshot when I run an Automation Test on mobile also on website at the same time? in java with selenium and attacted it to allure report :
@Override
public void onTestFailure(ITestResult result) {
LocalDateTime myDateObj = LocalDateTime.now();
DateTimeFormatter myFormatObj = DateTimeFormatter.ofPattern("dd/MM/yy HH:mm:ss");
String formattedDate = myDateObj.format(myFormatObj);
System.out.println("Test ended at: " + formattedDate);
System.out.println("Test " + result.getName() + " Failed");
Object webDriverAttribute = result.getTestContext().getAttribute("WebDriver");
if (webDriverAttribute instanceof WebDriver) {
AllureAttachment.attachScreenshot((WebDriver) webDriverAttribute);
}
}