Forum Discussion

pavanmac's avatar
pavanmac
Contributor
8 years ago

How to take a screen shot for a failed step??

Hi, 

Can you me suggest how to -

1. Take a screen shot for a failed step(Testcomplete using python)? 

 

2. If an error occurs and is displayed in "Script Test Log" and the failed step is in red color how to take screen shot of the log? 

 

3. Also how to Update the HTML result to excel sheet?? 

 

Please suggest the solutions for the above. !

3 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    1. You can use the following code for taking a screenshot:

     

    def take_screenshot(path):
        Sys.Desktop.Picture().SaveToFile(path)

    ''' 
    path should be a string with full path to your destination,
    e.g.
    "C:\\Users\\User\\Desktop\\shot.jpg"
    Sys.Desktop will provide a screenshot from the whole desktop.
    You can use any mapped object instead of
    Sys.Desktop
    '''

    2. Enable Post image on error option in your Project -> Properties -> Playback -> Log

     

    3. Currently TestComplete does not have an option to export log to Excel format, however you can create a feature request.

  • baxatob's avatar
    baxatob
    Community Hero

    I moved your topic here, because it touches new questions. 

     

    Just kindly ask you to rename the subject.

    • pavanmac's avatar
      pavanmac
      Contributor

      Hi , 

       

      I have edited the subject as per your suggestion. 

       

      Let me know about the solution!!