I have below code:
@AfterMethod()
public static void takeSnapShot(WebDriver webdriver, String fileWithPath) throws Exception {
// Convert web driver object to TakeScreenshot
TakesScreenshot scrShot = ((TakesScreenshot) webdriver);
// Call getScreenshotAs method to create image file
File SrcFile = scrShot.getScreenshotAs(OutputType.FILE);
// Move image file to new destination
File DestFile = new File(fileWithPath);
// Copy file at destination
FileUtils.copyFile(SrcFile, DestFile);
}
I'm getting below error
Can inject only one of
<ITestContext, XmlTest, Method, Object[], ITestResult>into a @AfterMethod annotated takeSnapShot.
I couldn't pass the driver value which contains the value stored from another class.
Help me to solve this or with different solution.