O'Reilly logo

Selenium WebDriver Practical Guide by Satya Avasarala

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an instance of EventListener

The EventListener class handles all of the events that are dispatched by the EventFiringWebDriver class. There are the following two ways to create an EventListener class:

  • By implementing the WebDriverEventListener interface.
  • By extending the AbstractWebDriverEventListener class provided in the WebDriver library.

It is up to you, as a test script developer, to choose which way to go by.

Implementing WebDriverEventListener

The WebDriverEventListener interface has all of the event methods declared. The EventFiringWebDriver class, as soon as it realizes an event has occurred, will invoke the registered method of WebDriverEventListener. Here, we have created an IAmTheEventListener named class and have implemented ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required