The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Replace Selenium’s removed Java event classes with WebDriverListener and EventFiringDecorator. Implement only the callbacks you need, decorate the original driver, then pass and use the decorated driver wherever events must be observed. Selenium removed the deprecated classes in version 4.17.0, released January 23, 2024.
What to replace
| Deprecated type or pattern | Replacement | Migration action |
|---|---|---|
WebDriverEventListener |
WebDriverListener |
Translate each callback name and signature; do not assume a class rename is sufficient. |
AbstractEventListener |
WebDriverListener |
Remove the adapter superclass and override only the default methods your code needs. |
EventFiringWebDriver |
EventFiringDecorator |
Decorate the original driver and use the returned driver. |
.register(listener1).register(listener2) |
new EventFiringDecorator(listener1, listener2) |
Pass listeners to the decorator constructor. |
The old event-listener classes were removed from Selenium’s Java binding in 4.17.0. The release announcement names WebDriverListener and EventFiringDecorator as replacements: Selenium 4.17.0 release announcement.
Update the listener and driver wiring
WebDriverListener provides empty default implementations, so a listener can focus on the events it actually uses. Selenium’s API documentation describes the interface as providing “empty default implementation for all methods that do nothing.”
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverListener;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.events.EventFiringDecorator;
public class NavigationListener implements WebDriverListener {
@Override
public void beforeGet(WebDriver driver, String url) {
System.out.println("Navigating to " + url);
}
@Override
public void afterGet(WebDriver driver, String url) {
System.out.println("Navigation call completed for " + url);
}
@Override
public void onError(Object target, java.lang.reflect.Method method,
Object[] args, java.lang.reflect.InvocationTargetException error) {
System.err.println("WebDriver call failed: " + method.getName());
}
public static void main(String[] args) {
WebDriver original = new FirefoxDriver();
WebDriver decorated = new EventFiringDecorator(
new NavigationListener()).decorate(original);
try {
decorated.get("https://example.com");
} finally {
decorated.quit();
}
}
}
This example uses the callback shapes exposed by the current Selenium Java API: check the Javadocs for the Selenium version pinned in your project when translating additional callbacks. In particular, after callbacks and error callbacks are distinct; make sure the error hook you implement matches the listener API signature in that version.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
The core migration pattern shown by Selenium is simply to create a listener, wrap the driver with new EventFiringDecorator(listener).decorate(original), and make calls on the decorated reference. The decorator wraps a WebDriver and can notify listeners about calls on the driver and derived objects such as WebElement and Alert. Its wrapper implements the same interfaces as the original driver. See EventFiringDecorator Java API.
Translate callbacks by behavior
Review every callback your old listener used. Match the operation and the arguments it receives, and decide whether your code needs to observe a call before execution, a successful result, or an exception.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
- Before callbacks: receive the call’s arguments before it runs.
- After callbacks: receive the arguments and result when the call succeeds.
- Error callbacks: handle calls that throw. Use the error event category if your old instrumentation recorded failures; a successful-call callback does not cover that case.
For example, Selenium’s migration article maps the old beforeAlertAccept(WebDriver) style to the new beforeAccept(Alert) callback. The target object and method signature have changed, not just the method name. The article also demonstrates generic callbacks such as beforeAnyCall and afterAnyCall, alongside more focused hooks for WebDriver and WebElement calls. Generic hooks can support broad logging of methods, arguments, results and thread context; method-specific hooks limit the scope and noise. Consult the Selenium event-firing documentation and WebDriverListener Java API for the signatures applicable to your version.
Keep all event-observed calls on the decorated driver
Assign the value returned by decorate and pass that reference to test setup, page objects and framework components that need event notifications. If one helper continues to call the original driver directly, those calls do not pass through the decorated wrapper. Selenium’s example likewise performs navigation and element lookup using the decorated variable.
Recommended Free Tools
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Handle custom invocation behavior separately
If the old implementation merely observed or logged calls, start with WebDriverListener. If it changed how calls behave—for example, customized findElement or decorated returned elements with metadata—evaluate a subclass of EventFiringDecorator. Selenium’s migration example overrides call handling and delegates uncustomized methods to super.call, and shows customization of decorated WebElement instances. This is a different migration from translating callbacks: preserve the custom behavior deliberately and test its interaction with the driver and framework.
Migration checklist
- Search source code and imports for
AbstractEventListener,EventFiringWebDriverandWebDriverEventListener. - Replace listener implementations with
WebDriverListener; keep only callbacks that the project uses. - Translate each callback by operation, parameter types and return/result behavior.
- Replace wrapper construction and chained registration with
new EventFiringDecorator(listener1, listener2)and.decorate(originalDriver). - Pass the decorated driver into every component whose calls need event coverage.
- Move exception instrumentation to the applicable error callbacks.
- Review any old custom invocation or returned-element behavior separately; consider an
EventFiringDecoratorsubclass where necessary. - Compile and run the project’s own tests against its pinned Selenium dependency, including framework integrations that use driver interfaces.
The official Java API marks both WebDriverListener and EventFiringDecorator as Beta, so confirm the API and project-specific wrapper behavior against the version you actually use. Selenium’s Java README documents the org.seleniumhq.selenium:selenium-java Maven or Gradle dependency and Java 11+ requirement: Selenium Java installation.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Common migration failures and fixes
- The old imports no longer compile: those event classes were removed in Selenium 4.17.0. Migrate to the listener and decorator API rather than trying to retain the removed imports.
- No callbacks fire: verify that calls use the reference returned by
decorate, and that the decorated reference is the one passed to page objects and helpers. - Callback override does not compile: compare the full method name and parameter types with the
WebDriverListenerJavadoc for the pinned Selenium version. Some callbacks now receive a target object such asAlertrather than the old driver parameter. - Failures are missing from logs: successful after callbacks are not failure callbacks. Add the matching error-event handling.
- Logging is overwhelming: replace broad generic interception with method-specific callbacks for the operations you need to observe.
- Custom behavior disappeared: a listener observes calls; it does not automatically reproduce overrides that changed invocation or returned objects. Recreate those deliberately in a decorator subclass and test them.
Or skip the browser setup
If the task is capturing a website rather than maintaining Selenium event instrumentation, ScreenshotNeo can return a screenshot with one GET request. This is not a replacement for Selenium listeners in a test framework.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation. Cookie banners, newsletter popups and chat widgets are removed before capture; bot checks, blank pages and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
Sign up free for 1,000 screenshots a month, with no card.
Quick Recap
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




