'Java Allure Report - Playwright | how to take screenshot on test failure

Selenium : Take screenshot method:

 " if (scenario.isFailed()) {
String screenshotName = scenario.getName().replaceAll(” “, “_”);
try {
TakesScreenshot ts = (TakesScreenshot) driver;
File sourcePath = ts.getScreenshotAs(OutputType.FILE);
File destinationPath = new File(
System.getProperty(“user.dir”) + “\\target\\cucumber-reports\\screenshots\\” + screenshotName + “.png”); "

Takes screenshot method is available is selenium, we need a solution for java+playwright or if allure-selenide also helps.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source