0

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);
    }
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.