How to capture the screenshot of failed testcase only among a set of testcases?
Answer Posted / suresh vemula
First we have to create a method of screen shot using java.
After that we have annotation in testng to identify the failure test case or methods using "iTestResult"
This iTestResult using only where annotation in aftermethod
@Aftermethod
Public void test(iTestResult.FAILURE==result.getStatus()){
Utility.screenshot(driver,result.getname());
}
Here utility.screenshot is java class to created for screenshot
Here getName() returns the failure test case name
Then you have to identify the failure test easily
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Explain me how many types of webdriver apis are available in selenium?
How to scroll down to a particular element?
Why should selenium be selected as a test program?
what is the difference between 2.0 & 3.0
How can you handle network latency using selenium?
Tell us how can you run selenium server other than the default port 4444?
What is the function of xpath?
Explain what are the different types of locators in selenium?
What are the different ways of locating a web element in selenium?
What is a node in selenium grid?
Tell me how can we launch different browsers in selenium webdriver?
How to check if a button is enabled on the page?
Tell me what api is required for database testing in selenium webdriver?
Name an api used for logging in java?
What is the difference between selenium ide, selenium rc, and webdriver?