eracuni/browser.py
def firefox(config: Config) -> webdriver:
    """
    Start browser with disabled "Save PDF" dialog
    Download files to var folder
    """
    my_options = Options()
    if config.headless:
        my_options.headless = True
        my_options.add_argument('--window-size=1920,1200')
    my_profile = webdriver.FirefoxProfile()
    my_profile.set_preference('general.useragent.override', config.user_agent)
    my_profile.set_preference('browser.download.folderList', 2)
    my_profile.set_preference('browser.download.manager.showWhenStarting', False)
    my_profile.set_preference('browser.download.manager.useWindow', False)
    my_profile.set_preference('pdfjs.disabled', True)
    my_profile.set_preference('browser.download.dir',
                              os.path.join(os.getcwd(), 'var'))
    my_profile.set_preference('browser.helperApps.neverAsk.openFile',
                              'application/octet-stream, application/pdf, application/x-www-form-urlencoded')
    my_profile.set_preference('browser.helperApps.neverAsk.saveToDisk',
                              'application/octet-stream, application/pdf, application/x-www-form-urlencoded')
    driver = webdriver.Firefox(executable_path=config.gecko_path(), options=my_options, firefox_profile=my_profile)
    driver.implicitly_wait(config.timeout)
    return driver

    Start browser with disabled "Save PDF" dialog
    Download files to var folder
    
Start browser with disabled "Save PDF" dialog
Download files to var folder
Start browser with disabled " Save PDF " dialog Download files to var folder
def firefox(config: Config) -> webdriver:
    my_options = Options()
    if config.headless:
        my_options.headless = True
        my_options.add_argument('--window-size=1920,1200')
    my_profile = webdriver.FirefoxProfile()
    my_profile.set_preference('general.useragent.override', config.user_agent)
    my_profile.set_preference('browser.download.folderList', 2)
    my_profile.set_preference('browser.download.manager.showWhenStarting', False)
    my_profile.set_preference('browser.download.manager.useWindow', False)
    my_profile.set_preference('pdfjs.disabled', True)
    my_profile.set_preference('browser.download.dir',
                              os.path.join(os.getcwd(), 'var'))
    my_profile.set_preference('browser.helperApps.neverAsk.openFile',
                              'application/octet-stream, application/pdf, application/x-www-form-urlencoded')
    my_profile.set_preference('browser.helperApps.neverAsk.saveToDisk',
                              'application/octet-stream, application/pdf, application/x-www-form-urlencoded')
    driver = webdriver.Firefox(executable_path=config.gecko_path(), options=my_options, firefox_profile=my_profile)
    driver.implicitly_wait(config.timeout)
    return driver
def firefox ( config : Config ) -> webdriver : my_options = Options ( ) if config . headless : my_options . headless = True my_options . add_argument ( '--window-size=1920,1200' ) my_profile = webdriver . FirefoxProfile ( ) my_profile . set_preference ( 'general.useragent.override' , config . user_agent ) my_profile . set_preference ( 'browser.download.folderList' , 2 ) my_profile . set_preference ( 'browser.download.manager.showWhenStarting' , False ) my_profile . set_preference ( 'browser.download.manager.useWindow' , False ) my_profile . set_preference ( 'pdfjs.disabled' , True ) my_profile . set_preference ( 'browser.download.dir' , os . path . join ( os . getcwd ( ) , 'var' ) ) my_profile . set_preference ( 'browser.helperApps.neverAsk.openFile' , 'application/octet-stream, application/pdf, application/x-www-form-urlencoded' ) my_profile . set_preference ( 'browser.helperApps.neverAsk.saveToDisk' , 'application/octet-stream, application/pdf, application/x-www-form-urlencoded' ) driver = webdriver . Firefox ( executable_path = config . gecko_path ( ) , options = my_options , firefox_profile = my_profile ) driver . implicitly_wait ( config . timeout ) return driver
Start browser with disabled "Save PDF" dialog
Download files to var folder
Start browser with disabled " Save PDF " dialog Download files to var folder
"""
    Start browser with disabled "Save PDF" dialog
    Download files to var folder
    """
config
Config