Creating EventFiringWebDriver and EventListener instances

Now that we have the basic driver instance, pass it as an argument while constructing the EventFiringWebDriver instance. We will be using this instance of the driver to execute all of the further user actions.

Now, using the following code, instantiate the EventListener, IAmTheEventListener.java, or IAmTheEventListener2.java class that we created previously. This will be the class to which all of the events are dispatched:

EventFiringWebDriver eventFiringDriver =         new EventFiringWebDriver(driver);IAmTheEventListener eventListener =         new IAmTheEventListener();

Get Selenium WebDriver 3 Practical Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.