Search code examples
javascreenshotselenium-ide

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 e.g. myscreenshot_YYYYMMDDHHss.png.

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


Solution

  • 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();

    Value: date

    next row..

    Command: captureEntirePageScreenshot

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

    Let me know if you have any more questions.