I need an After method to capture a screenshot compatible with Selenium 4 Java
Asked
Active
Viewed 407 times
-1
-
What have you tried? Where are you stuck? – Jeremy Caney Apr 14 '22 at 19:22
-
Please add sample code of existing selenium, seems like 3 and then ask for 4. Without code sample its hard to help here. – Sobhit Sharma Oct 19 '22 at 07:00
1 Answers
0
@After
public void tearDown(Scenario scenario) {
if (scenario.isFailed()) {
final byte[] screenshot = ((TakesScreenshot) Driver.get()).getScreenshotAs(OutputType.BYTES);
scenario.attach(screenshot, "image/png", "screenshot");
}
Driver.closeDriver();
}

Mehmet
- 1
- 1