#NEWLINE# def load_driver( config , vdisplay = None ) : #NEWLINE# #INDENT# 'Initialize a weddriver selected in config with given config.\n\n    Args:\n        config (dict): The configuration loaded previously in Cabu.\n\n    Returns:\n        webdriver (selenium.webdriver): An instance of selenium webdriver or None.\n    ' #NEWLINE# if ( config [ 'DRIVER_NAME' ] == 'Firefox' ) : #NEWLINE# #INDENT# driver = load_firefox ( config ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( config [ 'DRIVER_NAME' ] == 'Chrome' ) : #NEWLINE# #INDENT# driver = load_chrome ( config ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( config [ 'DRIVER_NAME' ] == 'PhantomJS' ) : #NEWLINE# #INDENT# driver = load_phantomjs ( vdisplay ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not config . get ( 'DRIVER_NAME' ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise DriverException ( vdisplay , 'Driver unrecognized.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# driver . set_page_load_timeout ( config [ 'DRIVER_PAGE_TIMEOUT' ] ) #NEWLINE# driver . set_window_size ( config [ 'DRIVER_WINDOWS_WIDTH' ] , config [ 'DRIVER_WINDOWS_HEIGHT' ] ) #NEWLINE# return driver