I am using TestNG framework. I have a Test1
class which extends BaseTestSuite
. Also I have a CustomListeners
class which implements WebDriverEventListener
. When I use @Listeners(CustomListeners.class)
annotation in the Test class, getting following error. Please help to resolve.
Type mismatch: cannot convert from Class<CustomListeners> to Class<? extends ITestNGListener>[]
Test Class
@Listeners(CustomListeners.class) //Error line
public class Test1 extends BaseTestSuite {
LoginPage lp;
TabMenu tm;
@Test(priority = 0, testName = "Verify Login")
public void login() throws Exception {
lp = new LoginPage(driver, test);
tm = new TabMenu(driver, test);
driver.get(Constants.url);
lp.verifyLoginPageLogo();
lp.setUserName("dmin");
lp.setPassword("admin");
lp.clickLoginBtn();
tm.verifyTabMenu();
tm.isCurrentTab("Dashboard");
}
}
Listeners Class
public class CustomListeners implements WebDriverEventListener {
/*
*
* All Implemented methods
*
*
*/
}