#NEWLINE# def _local_browser_class( browser_name ) : #NEWLINE# #INDENT# '\n    Returns class, kwargs, and args needed to instantiate the local browser.\n    ' #NEWLINE# LOGGER . info ( 'Using local browser: %s [Default is firefox]' , browser_name ) #NEWLINE# browser_class = BROWSERS . get ( browser_name ) #NEWLINE# if ( browser_class is None ) : #NEWLINE# #INDENT# raise BrowserConfigError ( 'Invalid browser name {name}.  Options are: {options}' . format ( name = browser_name , options = ', ' . join ( BROWSERS . keys ( ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( browser_name == 'firefox' ) : #NEWLINE# #INDENT# firefox_profile = webdriver . FirefoxProfile ( ) #NEWLINE# firefox_profile . set_preference ( 'media.navigator.permission.disabled' , True ) #NEWLINE# firefox_profile . set_preference ( 'browser.startup.homepage' , 'about:blank' ) #NEWLINE# firefox_profile . set_preference ( 'startup.homepage_welcome_url' , 'about:blank' ) #NEWLINE# firefox_profile . set_preference ( 'startup.homepage_welcome_url.additional' , 'about:blank' ) #NEWLINE# browser_args = [ ] #NEWLINE# browser_kwargs = { #NEWLINE# #INDENT# 'firefox_profile' : firefox_profile , #NEWLINE# #UNINDENT# } #NEWLINE# if os . environ . get ( 'SELENIUM_FIREFOX_PATH' , None ) : #NEWLINE# #INDENT# binary_kwarg = { #NEWLINE# #INDENT# 'firefox_binary' : FirefoxBinary ( firefox_path = os . environ . get ( 'SELENIUM_FIREFOX_PATH' ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# browser_kwargs . update ( binary_kwarg ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( browser_name == 'chrome' ) : #NEWLINE# #INDENT# chrome_options = Options ( ) #NEWLINE# chrome_options . add_argument ( '--use-fake-device-for-media-stream' ) #NEWLINE# chrome_options . add_argument ( '--use-fake-ui-for-media-stream' ) #NEWLINE# browser_args = [ ] #NEWLINE# browser_kwargs = { #NEWLINE# #INDENT# 'chrome_options' : chrome_options , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( browser_args , browser_kwargs ) = ( [ ] , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# return ( browser_class , browser_args , browser_kwargs )