String TDate=new Date()
Screen=WebUI.concatenate([TDate, ‘Screen’,‘.png’] as String)
WebUI.takeScreenshot(‘C:\Users\l991256\Katalon Studio\Screeshots\’+Screen)
WebUI.takeScreenshot(WebUI.concatenate(‘C:\Users\l991256\Katalon Studio\Screeshots\’,Screen))
Tried lot o options but did not worked
In that case how i am suppose to create unique screen shot name.I cant’s overwrite the file for every execution
The output of this line Screen=WebUI.concatenate([TDate, ‘Screen’,’.png’] as String[]) contains restricted character for filename ( on Windows, so you can’t save screenshot using this kind of generated filename.
I was having the same problem. After each test execution my screenshot files were overwritten. I couldn’t find an appropriate solution in Katalon so I came up with a workaround. After each test execution I run a batchfile which replaces the name(s) with a number and date. Like so:
@echo on
cd\
cd users\user\mydocuments
setlocal EnableDelayedExpansion
set Filename=FileTitle
set suffix=100
for /F “delims=” %%i in (‘dir /B *.png’) do (
set /A suffix+=1
ren “%%i” “%filename%-!suffix:~1! somename_%time:~0,2%%time:~3,2%-%DATE:/=%.png”
)