Introducing the eventFiringWebDriver and eventListener classes

The EventFiringWebDriver class is a wrapper around the WebDriver that gives the driver the capability to fire events. The EventListener class, on the other hand, waits to listen to EventFiringWebDriver and handles all of the events that are dispatched. There can be more than one listener waiting to hear from the EventFiringWebDriver class for an event to fire. All of the event listeners should be registered with the EventFiringWebDriver class to get notified.

The following flow diagram explains what has to be done to capture all of the events raised by EventFiringWebDriver during the execution of test cases:

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.