#NEWLINE# def _execute( self , command , params = None ) : #NEWLINE# #INDENT# 'Overriding in order to catch StaleElementReferenceException.' #NEWLINE# result = None #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# result = super ( WebElementWrapper , self ) . _execute ( command , params ) #NEWLINE# break #NEWLINE# #UNINDENT# except exceptions . StaleElementReferenceException : #NEWLINE# #INDENT# if ( result . reload_failed or ( self . stale_reference_occurrence > self . STALE_ELEMENT_REFERENCE_MAX_TRY ) ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# time . sleep ( self . STALE_ELEMENT_REFERENCE_WAIT ) #NEWLINE# try : #NEWLINE# #INDENT# self . _reload_element ( ) #NEWLINE# #UNINDENT# except ElementNotReloadableException : #NEWLINE# #INDENT# if self . web_element_reload : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . reload_failed = True #NEWLINE# #UNINDENT# #UNINDENT# self . stale_reference_occurrence += 1 #NEWLINE# #UNINDENT# #UNINDENT# self . stale_reference_occurrence = 0 #NEWLINE# return result