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.