#NEWLINE# @ property #NEWLINE# def webdriver( self ) : #NEWLINE# #INDENT# 'Return the webdriver instance, instantiate it if necessary.' #NEWLINE# if ( self . _webdriver is None ) : #NEWLINE# #INDENT# short_arg_classes = ( webdriver . Firefox , webdriver . Ie ) #NEWLINE# if issubclass ( self . _browser , short_arg_classes ) : #NEWLINE# #INDENT# cap_attr = 'capabilities' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cap_attr = 'desired_capabilities' #NEWLINE# #UNINDENT# options = self . _options #NEWLINE# options [ cap_attr ] = self . _desired_capabilities #NEWLINE# self . _webdriver = self . _browser ( ** options ) #NEWLINE# self . crawler . signals . connect ( self . _cleanup , signal = engine_stopped ) #NEWLINE# #UNINDENT# return self . _webdriver