def driver_init(): chrome_options = Options() if not app_settings.webdriver_visible: chrome_options.add_argument("--headless") chrome_options.add_argument("--window-size={},{}".format( SCREEN_WIDTH, SCREEN_HEIGHT)) chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-infobars") driver = Chrome(options=chrome_options) driver.app_settings = app_settings return driver
def driver_init(): chrome_options = Options() if not app_settings.webdriver_visible: chrome_options.add_argument("--headless") if not app_settings.secure: chrome_options.add_argument('--ignore-certificate-errors') chrome_options.add_argument("--window-size={},{}".format(SCREEN_WIDTH, SCREEN_HEIGHT)) chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-infobars") chrome_options.add_argument('lang=en') chrome_options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'}) driver = Chrome(options=chrome_options) driver.app_settings = app_settings return driver
def driver_init(): chrome_options = Options() if app_settings.webdriver_visible and is_docker(): raise SystemExit( "ERROR: WEBDRIVER_VISIBLE is True in .yml, but Docker container does not have a display." ) if not app_settings.webdriver_visible: chrome_options.add_argument("--headless") if not app_settings.secure: chrome_options.add_argument('--ignore-certificate-errors') chrome_options.add_argument("--window-size={},{}".format( SCREEN_WIDTH, SCREEN_HEIGHT)) chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-infobars") chrome_options.add_argument('lang=en') chrome_options.add_experimental_option( 'prefs', {'intl.accept_languages': 'en,en_US'}) driver = Chrome(options=chrome_options) driver.app_settings = app_settings return driver