Listening for browser NavigateTo events

As we've seen earlier, this event occurs whenever the driver executes driver. get(url). The related methods for this event are as follows:

  • public void beforeNavigateTo(java.lang.String url, WebDriver driver)
  • public void afterNavigateTo(java.lang.String url, WebDriver driver)

The URL that is used for the driver-navigation is passed as a parameter to the preceding methods, along with the driver that triggered the event.