Listening for an exception

This event occurs when the WebDriver comes across an exception. For instance, if you try to search for a WebElement using findElement(), and that element doesn't exist on the page, the driver throws an exception (NoSuchElementException). At this point, this event is triggered, and the following method gets notified:

public void onException(java.lang.Throwable throwable, WebDriver driver)

In all the after<<event>> methods, we have seen that they will not be invoked if the driver comes across any exception. In that case, instead of those after<<event>> methods, the onException() method is invoked and the throwable object and the WebDriver object are sent to it as parameters.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.81.58