i'm writing tests in jscript in testcomplete. need make screenshot of web page element, , save desktop png file.
i tried code:
var mypicture = webpage.somelocation.picture(); mypicture.savetofile("c:\desktop"); which doesn't seem working, , can't seem figure out why. program doesn't crash or anything, doesn't save picture. doing wrong?
savetofile needs full name of image create, including path. remember in jscript must double backslashes in paths.
to desktop folder path, can use specialfolders property.
var mypicture = webpage.somelocation.picture(); var strimagename = "mypicture.png"; // desktop folder path var strdesktop = sys.oleobject("wscript.shell").specialfolders("desktop"); // build full path image var strpath = aqfilesystem.includetrailingbackslash(strdesktop) + strimagename; mypicture.savetofile(strpath);
Comments
Post a Comment