How does Report Portal take screenshots of failed testcases in the case of TestNG framework?

1.3k Views Asked by At

Does Report Portal use WebDriver to take the screenshot of failed testcases? I did not see the usage of WebDriver in the source code of the java-testNG listener agent. May i know how this is done? Or RP does not have the capability of capturing the screenshot for TestNG based frameworks?

1

There are 1 best solutions below

0
On

ReportPortal does not take your screenshot, you need to implement the code from web driver to take the screenshot and then send it to ReportalPortal by using your logger (log4j2/log4j/logback).

for example (from local browser-chrome)

 Screenshot screenshot = new Screenshot(this);
 
 LOGGER.debug("RP_MESSAGE#FILE#{}#{}", screenshot.takeScreenShot(imageName,true), "snapshot");