How to take a screenshot on failure?

Hi,

How do I take a screenshot when my any test fail in test suite?

Thanks,

Sharmishtha

 

On fail, it automatically takes sceenshot if we checked “Take Screenshot when execution failed”.

Project > Setting >Report

1 Like

Where is it saved? I checked both report and the directory in temp, and I didn’t find the screenshots…
Or are they saved? I didn’t see any notifications about screenshots, but I’ve checked “Take Screenshot when execution failed”

@Xinyu:
Which execution level is it when you run your script? Test case or Test Suite?
The screenshots will be saved in the report folder by default, but the reports are just automatically generated when you run test suite or test suite collection.

Hi,
I’m using Katalon 5.3.0 version,it is unable to capture screen shot on failure.I’m running a test suite,it is displaying message “Unable to take screen shot”.In Settings under Project “Take screen shot when execution is failed” is checked.

Im having the same trouble, the image doesnt appear on the report folder, and it doesnt appear on the .html file in the console says

[WARNING] - Cannot take screenshot

JKFGVIRP 8OEHT;LWEIT6GB WLer;uo fhui yb79y rr

1 Like

Rama Krishna said:

Hi,
I’m using Katalon 5.3.0 version,it is unable to capture screen shot on failure.I’m running a test suite,it is displaying message “Unable to take screen shot”.In Settings under Project “Take screen shot when execution is failed” is checked.

Hey! Idk if you already found out what was the problem, in case you didnt, i found it, the software sometimes isnt able to take the screenshot because the page takes a little time to load, so, the software runs the script to take the screenshot, but , if the page isnt loaded, well, it wont take the screenshot, so, try writing WebUI.waitForPageToLoad(how many seconds) after the WebUI.navigateToUrl. hope this helps you!

I’ve tried this but still not works :frowning:

WebUI.waitForPageToLoad
or
WebUI.waitForPageLoad

Video is created correctly, but screenshots are not…is here any work around?

Run the test suite, and after it’s finished, right click it, and export it as a PDF, see if the screenshots show up on the PDF.

If so, Check the reports folder on your actual pc, not in Katalon.

1 Like

If you execute your tests using built-in keywords and failed steps happened due to the following reasons:
- Element can’t be found
- Element is not visible/clickable, v.v…

So in general, failed steps which interact with the current browser will have their own captured screenshots and they can be founded in generated report’s folder.

nope, they are not :frowning:

I also have a problem about the screen capture issue. It is fine that I can take a screen snapshot when the test suite is failure and I can see the picture in the report as well. However when I integrate with Jenkins, I cannot view any picture in all the report on Jenkins Server and I found that the image source is not as usual as other image source like “c://path”. The image source in the report looks like encrypted by default. How do I fixed it in order to view test suite report normally with any picture?

Hello community its a bug, but I have solved for it

Step to fix it :

1. Default true for this option screenshot on fail
2. Create new project / open existing
3. Create one sample test case
4. Drag this into test suite
5. Do fail in test case (*3) eg. WebUI.Check in text input
6. Run this test suite
7. See result in raports - no screenshot
8. Go again into Settings uncheck option screenshot fail
9. Run test suite
10. raports ? no screenshot !
11. Go again into yo options - now check again (true) option screenshot fail
12. Run test sutie
13. Work brushy brushy good
you can find png file, screenhot in pdf / html etc.

yu welcom

1 Like

Hello Team,

If i specify KeywordUtil.MarkFailed at a step, I believe Katalon Studio should take a screenshot of this step, which is not happening at the moment. Could someone from Katalon please look into this?

This worked for me. Thank you