Forum Discussion

NS189's avatar
NS189
Occasional Contributor
10 years ago
Solved

Can we add screen shot (pictures) to a folder on C drive while running test script

I need to take screen shots during execution of our test scripts and save these screen shots (aka picture) in different folders on hard drive. I have tried the Sys.Desktop.Picture(x,y,w,h) method to ...
  • NS189's avatar
    10 years ago

    I think I figured it ....here is how I did it and it works for what I need to do :

     

    var filepath = "C:\\PicsLib\\f1";

    var filepicName = "dpicfile.png";

     

    //add pic

    var picname = "mypic1";

    var rpic = Sys.Desktop.Picture(10,10,1900,1001);

    Regions.AddPicture(rpic,picname);

     

    var rpicFullname = filepath+"\\"+filepicName;

    var picObj = Regions.GetPicture(picname);

    if( picObj ){

         picObj.SaveToFile(rpicFullname);

    }