How to take screenshot of failed test cases in Selenium Webdriver

preview_player
Показать описание
As a good automation practise we should keep in mind that if test case is failing it should take screenshot.

In this post we will see how to capture / take screenshot in Seleniu Webdriver

Using ITestResult we can implement the same so lets discuss.

You can check below article on my blog too.

-~-~~-~~~-~~-~-
Please watch: "How To Create Maven build For Selenium Framework"
-~-~~-~~~-~~-~-
Рекомендации по теме
Комментарии
Автор

Awesome:)You always make logic very simple.I just love all your videos.Good job:)Keep going.

rakshareddy
Автор

Thank you so much for this simple & easy to understandable video, i implemented same in project. It worked :)

poonamthakur
Автор

Thanks Its Super Simple and Clear Stepwise explanation

devineechoes
Автор

Hi Mukesh, I am a manual tester, now I learning automation java with selenium, please suggest to me which videos I have to refer .

goutamsethi
Автор

Nice Work Mukesh.
Really Appreciate your work.
I learned lot of things from your videos.
Keep up the good work.

asankarana
Автор

Thanks Mukesh. U r doing a commendable work by providing very useful videos. U explain all concepts in very clear way. Thanks a lot

pushkarbajpai
Автор

Hi Mukesh, how do I implement this strategy on Junit as well, seems to work only on TestNG and by the way you rock man. Thanks for all the help.

akanamontana
Автор

Hi Mukesh,
Your teaching and explanation is excellent I loved it.
I have one question which is,
In cell I click on drop down and select a value, after selecting the value it'll move to next cell and will do same action so, can you please explain it?

naveenk
Автор

but if the failure is due to a hard assert, then the execution will stop at that statement, it wont go to the @after method. Am i missing something here?

binaryautomation-sdets
Автор

hello sir all of your videos are very helpful !
recently i tried taking screenshot of fail test cases it only takes screenshot of window where the test case got failed, My point is the screenshot should include error message and red signs also how to do it ?
thanks in advance!

desiChiraiya
Автор

Thank you Mukesh sir, your tutorials are helpfull

surajwarade
Автор

Hi mukesh, In this video, you explained how to take a screenshot if a test case fail, so the screenshot comes in the name of the test case. suppose the test case has more than one assert and I'm using soft assert my whole test case is going to pass but suppose in my test more then one assert fail so how to take screenshots of all the assert fail and provide a name to those screenshot related to the assert?

chetansahu
Автор

Very Informative...and a frequently asked Selenium interview question !! Do you have any video on the step where lets say step is passed and we have to validation with Assert.assert method

hossenchannel
Автор

Thanks for the simple explanation bro :)

kannansekar
Автор

Hi Mukesh the videos are very helpful

Can you please tell how to take the screenshots and put in a word document one after the other?

anitham
Автор

Thank you for sharing such a great tutorial i have few things to request if you can make it in one video tutorial i'll be very thankful to you.

salwakhan
Автор

Hello sir, I am taking multiple inputs from excel sheet and running a test case . If 2 or more input tests fail then also this will create single screenshot because result.getName() returns the same name on every failer so this will create a single screenshot every time due to the same name. Please tell me how to set a different name to every failure test screenshot?

abhijeetyadav
Автор

Hi Mukesh Really very nice step wise explanation.
Thanks
Appreciated
Need your help and opinion, which is best eclipse plugin or any other software to open *.png

hareped
Автор

Hi Mukesh, As usual a very good informative video Thanks a lot.
How can we take the screenshot using Listeners?

vinann
Автор

Hi Mukesh, Why did you put "ITestResult result" as a parameter for the method. Why cannot be simply declare it as in the body of the method.

yorkmena