How to take screenshot of failed test cases in Selenium

Published: 27 August 2021
on channel: automateNow
1,389
27

Learn how to take a screenshot of failed test cases in Selenium.

TestNG offers an interface called ITestListener, we can use a method called onTestFailure() within this interface in order to take a screenshot of failed tests. This video will show you how to implement this method.

You can find the source code for this project on automateNow's GitHub page.
https://github.com/automatenow/Interm...

😀 Subscribe for weekly videos! 👍

📑 CHAPTERS

0:00 ~ Why taking screenshots of failed tests is useful
0:14 ~ Add a utilities package and class
0:56 ~ Implement ITestListener methods
1:58 ~ Create directory to store screenshots
2:19 ~ Implement onTestFailure() method
3:03 ~ Run a test that takes a screenshot
5:43 ~ Add the failed test to the screeshot file name
7:19 ~ Explaining onTestStart() method

👩‍🎓 COURSES

☕ Java For Absolute Beginners https://bit.ly/learn-java2022

⏯ PLAYLISTS

☑️ Automation Fundamentals https://bit.ly/2QbN7qm
☑️ Automation Tools https://bit.ly/2OFj4qO
☑️ General WebDriver https://bit.ly/2Z3tG7y
☑️ Intro to WebDriver https://bit.ly/3gb5Jlx
☑️ Intermediate WebDriver https://bit.ly/2OBTR0r
☑️ Java https://bit.ly/3sBuI7M
☑️ Selenium 4 https://bit.ly/2VQ1lA9
☑️ Version Control https://bit.ly/3CvHplU
☑️ Web Element Locators https://bit.ly/2QfDGpK

📫 LET'S CONNECT!

☑️ https://linktr.ee/automateNow


Watch video How to take screenshot of failed test cases in Selenium online without registration, duration hours minute second in high quality. This video was added by user automateNow 27 August 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,389 once and liked it 27 people.