Reputation: 3547
How to insert a timestamp when taking a screenshot of fool page with imacros.
ONDOWNLOAD FOLDER=C:\folder\ FILE=SCREENTEST.PNG
TAG POS=1 TYPE=HTML ATTR=CLASS:* CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT
I am using this code. Works well but I want timestamp to put inside FireFox window, The addons I tried are outside of window. Meaning, iMacros doesn't catch them.
Tnx
Upvotes: 0
Views: 331
Reputation: 5299
See how the following code works and adjust it according to your needs:
SET ts {{!NOW:yyyy-mm-dd<SP>hh:nn:ss}}
SET S "var doc = window.document; var elt = doc.createElement('p'); elt.align = 'right'; elt.innerHTML = '<font color=red><b>{{ts}}'; doc.body.appendChild(elt); undefined;"
URL GOTO=javascript:{{S}}
' your screenshot taking here
JS wrapping of the code above with two parameters included:
var ts = imns.formatDate("yyyy-mm-dd hh:nn:ss");
var tsColor = "red";
var tsSize = 5;
window.location.href = "javascript:var doc = window.document; var elt = doc.createElement('p'); elt.align = 'right'; elt.innerHTML = '<font color=" + tsColor + " size=" + tsSize +"> <b>" + ts + "'; doc.body.appendChild(elt); undefined;";
Upvotes: 1