I have created a file with the name SeleniumTestListener.java
and I have written the below code:
@override
@AfterMethod(alwaysrun=true)
public class UITestNGListener extends AbstractWebDriverEventListener
{
// TODO Auto-generated method stub
@Override
@AfterTest(alwaysRun=true)
public void onException(Throwable exception, WebDriver driver) {
System.out.println("Failed Failed Failed");
}
Now when I am trying to run the script(purposely making it to fail after login into my application)
But it is failing with a configuration issue
org.testng.TestNGException: Method onException requires 2 parameters but 0 were supplied in the @Configuration annotation.
Can someone please help how to pass the values(throwable exception, webdriver driver) for this?
Thanks much for the help