Listening for script execution

This event is triggered whenever the driver executes a JavaScript. The associated methods for this event are as follows:

  • public void beforeScript(java.lang.String script, WebDriver driver)
  • public void afterScript(java.lang.String script, WebDriver driver)

The preceding methods get the JavaScript that was executed as a string, and the WebDriver that executed it as a parameter. If an exception occurs during script execution, the afterScript() method will not be invoked.

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.