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.

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.