The EventFiringWebDriver class
The EventFiringWebDriver class is a sort of API that encloses arbitrary WebDriver instances to register WebDriverEventListener; it provides an automatic system to trigger events. For example, whenever a test failure occurs, the automatic screen capture method gets activated and starts logging screenshots. The EventFiringWebDriver class is highly recommended for better reporting and test maintenance. Through EventFiringWebDriver, the user can have full control over the web page under test, including control over navigation, over finding elements, on exception, the click action, over script execution, and so on.
Follow these regulations to run tests through EventFiringWebDriver:
Create a
Listenersclass by either implementing theWebDriverEventListenerinterface or extending theAbstractWebDriverEventListenerclass:public class Listeners extends AbstractWebDriverEventListener {... } public class Listeners implements WebDriverEventListener {... }Now, create a...