How to capture screenshot for passed step and store with unique name?

As per client requirement I need to capture screen shots for passed step as a evidence.

To handle this I was using takeScreenshot option.

WebUI.takeScreenshot(“C:\\Users\\xxxxxx\\Katalon Studio\\ProjectName\\Reports\\Screenshot\*TC01Login.png*”)

There are two things which is becoming difficult to handle:

  1. When I handover the project of - user name(xxxxxx) differs and it becomes a manual activity to change the name(xxxxxx) at all places where take screenshot option is used in the scripts.

  2. If I define the path as a variable without giving any name , screen shot get overridden and it is not captured uniquely within a test case.

WebUI.takeScreenshot(“C:\\Users\\xxxxxx\\Katalon Studio\\ProjectName\\Reports\\Screenshot\**(No screenshot name defined here)**”)

Kindly suggest what can be a workaround for above points…

is there any possible to define the path in variable and then concatenate with screen shot name … to make it unique (path+name).

For example:

path = “C:\\Users\\xxxxxx\\Katalon Studio\\ProjectName\\Reports\\Screenshot\”





You can try as follow




Solution works !
Thanks a lot !