import selenium import selenium.webdriver import logging settings = {} def init(settings_obj): global settings settings = settings_obj def create_webdriver(driver='chrome'): if driver == 'chrome': return create_webdriver_chrome() elif driver == 'firefox': return create_webdriver_firefox() def create_webdriver_firefox(): pass def create_webdriver_chrome(): opt = selenium.webdriver.chrome.options.Options() opt.add_argument('--user-agent=' + settings.WEBDRIVER_USER_AGENT) opt.add_argument('--kiosk-printing') opt.add_argument("--focus-existing-tab-on-open=false") driver = selenium.webdriver.Chrome(chrome_options = opt) return driver