def driver():
if exists(screenshot_dir):
shutil.rmtree(screenshot_dir)
os.mkdir(screenshot_dir)
firefox_path = '{0}/firefox/firefox'.format(DIR)
caps = DesiredCapabilities.FIREFOX
caps["marionette"] = True
caps['acceptSslCerts'] = True
binary = FirefoxBinary(firefox_path)
profile = webdriver.FirefoxProfile()
profile.add_extension('{0}/JSErrorCollector.xpi'.format(DIR))
profile.set_preference('app.update.auto', False)
profile.set_preference('app.update.enabled', False)
driver = webdriver.Firefox(profile,
capabilities=caps, log_path="{0}/firefox.log".format(LOG_DIR),
firefox_binary=binary, executable_path=join(DIR, 'geckodriver/geckodriver'))
# driver.set_page_load_timeout(30)
# print driver.capabilities['version']
return driver
评论列表
文章目录