Friday, 11 April 2014

WebDriver and TestNG: Capture Screenshot when Test fails

In this post will cover how to capture screenshot using Selenium WebDriver and TestNG Listeners when any test fails. To do so we have to extend TestListenerAdapter class.


TestListenerAdapter class implements ITestListener interface, So whenever a test fails it invokes method onTestFailure(ITestResult tr) and that we will use to call our custom method to take screenshot.




No comments:

Post a Comment