I am using a listener class with ReportNG to capture screenshot of failed test cases. The problem is When I am using following in listener class:
WebDriver driver = new FirefoxDriver();
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
Problem :Webdriver opens another blank browser window as the listener class is not doing anything.And captures blank screenshot.
So my objective is to take screenshot of failed test case written in base class from Listener class.
Please help me.
I got it resolved by defining a static method for capturing screenshot in Base class and calling it by class name in my Listener class.
Thanks People.