#NEWLINE# def __init__( self , crawler ) : #NEWLINE# #INDENT# self . crawler = crawler #NEWLINE# self . _lock = Lock ( ) #NEWLINE# self . _wait_queue = deque ( ) #NEWLINE# self . _wait_inpage_queue = deque ( ) #NEWLINE# self . _browser = crawler . settings . get ( 'WEBDRIVER_BROWSER' , None ) #NEWLINE# self . _user_agent = crawler . settings . get ( 'USER_AGENT' , None ) #NEWLINE# self . _options = crawler . settings . get ( 'WEBDRIVER_OPTIONS' , dict ( ) ) #NEWLINE# self . _webdriver = None #NEWLINE# if isinstance ( self . _browser , basestring ) : #NEWLINE# #INDENT# if ( '.' in self . _browser ) : #NEWLINE# #INDENT# ( module , browser ) = self . _browser . rsplit ( '.' , 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( module , browser ) = ( 'selenium.webdriver' , self . _browser ) #NEWLINE# #UNINDENT# module = __import__ ( module , fromlist = [ browser ] ) #NEWLINE# self . _browser = getattr ( module , module ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if inspect . isclass ( self . _browser ) : #NEWLINE# #INDENT# self . _browser = self . _browser #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _webdriver = self . _browser