Listening for the clicked WebElement

This event occurs when a WebElement is clicked, that is, by executing webElement.click(). There are two methods to listen for this event in the WebDriverEventListener implementation:

public void beforeClickOn(WebElement element, WebDriver driver)

The preceding method is invoked when the WebDriver is about to click on a particular WebElement. The WebElement that is going to be clicked on and the WebDriver that is clicking on it are sent as parameters to this method so that the test-script developer can interpret which driver performed the click action, and on which element the action was performed:

public void afterClickOn(WebElement element, WebDriver driver)

The EventFiringWebDriver class notifies the ...

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.