#NEWLINE# def get_screenshot_as_file( self , filename ) : #NEWLINE# #INDENT# "\n        Gets the screenshot of the current window. Returns False if there is\n           any IOError, else returns True. Use full paths in your filename.\n\n        :Args:\n         - filename: The full path you wish to save your screenshot to.\n\n        :Usage:\n            driver.get_screenshot_as_file('/Screenshots/foo.png')\n        " #NEWLINE# png = self . get_screenshot_as_png ( ) #NEWLINE# try : #NEWLINE# #INDENT# with open ( f , 'wb' ) as f : #NEWLINE# #INDENT# f . write ( png ) #NEWLINE# #UNINDENT# #UNINDENT# except IOError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# del png #NEWLINE# #UNINDENT# return True