简体   繁体   中英

Timestamped screenshots with selenium IDE

I am using Selenium IDE for simple testcases and some automation. I have not much knowhow on Java or Javascript.

Currently I work on a testcase that captures several screenshots. Therefore I need a unique filename eg myscreenshot_YYYYMMDDHHss.png .

How can I achieve this? Thanks for your help in advance.

You can try this one:

Command: storeEval

Target: var d = new Date(); var m = ((d.getMonth()+1)<10)?'0'+(d.getMonth()+1):(d.getMonth()+1); m+"-"+d.getDate()+"-"+d.getFullYear()+"_"+d.getHours()+"-"+d.getMinutes(); var d = new Date(); var m = ((d.getMonth()+1)<10)?'0'+(d.getMonth()+1):(d.getMonth()+1); m+"-"+d.getDate()+"-"+d.getFullYear()+"_"+d.getHours()+"-"+d.getMinutes();

Value: date

next row..

Command: captureEntirePageScreenshot

Target: C:\\\\SampleDirectory\\\\${date}.png

Let me know if you have any more questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM