How to Save Screenshot along with current datetime?

uiautomation
activities

#1

HI,

I am trying to save screenshot in the following format.
“FileName+CurrentDateTime.png”

But unable to use “DATETIME” DataType and am getting the following error.

" Save image : Save image failed. Check if the file name is a valid path"

please, help me out with it.

Regards,
Faizan.


#2

Hello there,
Because Datetime has space while executing .Hence it’s not valid name.
Try something like this for ex:

“Image”+now.ToString(“dd-MM-yyyy”)+".png"


#3

@ddpadil Thanks Mate. It worked out fine.


#4

HI is there a way to save the screenshot in the same share path and we can differentiate between them other than time and date for example i have a component named ID can i save the screenshot like “Image”+ID.png…Please help