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
What is an ARIA Snapshot in Playwright? An ARIA snapshot in Playwright is a structured representation of a page’s accessibility tree , which is used by assistive technologies (e.g., screen readers) to interpret the content of a web page. This snapshot helps verify if elements have the correct roles, names, and properties required for accessibility. Playwright provides the page.accessibility.snapshot() API to capture this accessibility tree at any given moment during test execution. How Does ARIA Work? ARIA ( Accessible Rich Internet Applications ) is a set of attributes that help improve accessibility by defining roles, states, and properties for elements that are not natively accessible. Example: In this case, the aria-label ensures that screen readers identify the button as “Submit Form.” How to Use ARIA Snapshots in Playwright? Playwright’s accessibility.snapshot() method retrieves the accessible structure of the page. Ex...
Comments
Post a Comment