Selenium provides an API for various events that occur when our scripts are executed like click, switch to a window, navigation, onException, etc. and these can be registered using WebDriverEventListener interface or EventFiringWebDriver class. These events play a pivotal role in analyzing results and in debugging issues (if any).
EventFiringWebDriver class takes care of all events that are occurred while the execution of your script. EventFiringWebDriver class can be bind to more than one listener but all event listeners should be registered with the EventFiringWebDriver class so that it can be notified.
EventFiringWebDriver eventFiring =new EventFiringWebDriver(driver);
FirstEventCapture firstListener =new FirstEventCapture(); //FirstEventCapture implements WebDriverEventListener
SecondEventCapture secondListener =new SecondEventCapture(); //SecondEventCapture implements WebDriverEventListener
eventFiring.register(firstListener);
eventFiring.register(secondListener);
Check this link to know details about all the methods in WebDriverEventListener Interface: https://selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/events/WebDriverEventListener.html
Note* WebDriver listener (WebDriverEventListener) is doing a similar job like TestNG listeners i.e. of logging/reporting things but both work on different events. WebDriverEventListener works on different automation events like click, navigation, etc. whereas TestNG works on different test's related events like onStart(), beforeStart(), etc.
selenium testautomation automationtesting eventListener
As API testing becomes more central to modern software development, the tools we use to test, automate, and debug APIs can make a big difference. For years, Postman has been the go-to API client for developers and testers alike. But now, Bruno , a relatively new open-source API client, is making waves in the community. Let’s break down how Bruno compares to Postman and why you might consider switching or using both depending on your use case. ✨ What is Bruno? Bruno is an open-source, Git-friendly API client built for developers and testers who prefer simplicity, speed, and local-first development. It stores your API collections as plain text in your repo, making it easy to version, review, and collaborate on API definitions. 🌟 What is Postman? Postman is a full-fledged API platform that offers everything from API testing, documentation, and automation to mock servers and monitoring. It comes with a polished UI, robust integration, and support for collaborati...
Comments
Post a Comment