def get_driver(self, task):
"""Get the webdriver instance"""
from selenium import webdriver
path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'support', 'IE')
reg_file = os.path.join(path, 'keys.reg')
if os.path.isfile(reg_file):
run_elevated('reg', 'IMPORT "{0}"'.format(reg_file))
if platform.machine().endswith('64'):
path = os.path.join(path, 'amd64', 'IEDriverServer.exe')
else:
path = os.path.join(path, 'x86', 'IEDriverServer.exe')
capabilities = webdriver.DesiredCapabilities.INTERNETEXPLORER.copy()
capabilities['ie.enableFullPageScreenshot'] = False
if not task['cached']:
capabilities['ie.ensureCleanSession'] = True
driver = webdriver.Ie(executable_path=path, capabilities=capabilities)
return driver
评论列表
文章目录