#NEWLINE# def capture_screen( self , filepath ) : #NEWLINE# #INDENT# if ( not self . get_binary_path ( 'scrot' ) ) : #NEWLINE# #INDENT# self . logger . debug ( 'Could not take screenshot as scrot is not installed.' ) #NEWLINE# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# tempfile = self . path . join ( self . working_directory , os . path . basename ( filepath ) ) #NEWLINE# self . execute ( 'DISPLAY=:0.0 scrot {}' . format ( tempfile ) ) #NEWLINE# self . pull_file ( tempfile , filepath ) #NEWLINE# self . delete_file ( self ) #NEWLINE# #UNINDENT# except DeviceError as e : #NEWLINE# #INDENT# if ( "Can't open X dispay." not in e . message ) : #NEWLINE# #INDENT# raise e #NEWLINE# #UNINDENT# message = e . message . split ( 'OUTPUT:' , 1 ) [ 1 ] . strip ( ) #NEWLINE# self . logger . debug ( 'Could not take screenshot: {}' . format ( message ) )