#NEWLINE# def screenshot( self , filename , scale = 1.0 , quality = 100 ) : #NEWLINE# #INDENT# 'take screenshot.' #NEWLINE# result = self . server . screenshot ( filename , scale , quality ) #NEWLINE# if result : #NEWLINE# #INDENT# return result #NEWLINE# #UNINDENT# device_file = self . server . jsonrpc . takeScreenshot ( 'screenshot.png' , scale , quality ) #NEWLINE# if ( not device_file ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# p = self . server . adb . cmd ( 'pull' , device_file , filename ) #NEWLINE# p . wait ( ) #NEWLINE# self . server . adb . cmd ( 'shell' , 'rm' , device_file ) . wait ( ) #NEWLINE# return ( filename if ( p . returncode is 0 ) else None )