internet_explorer.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:wptagent 作者: WPO-Foundation 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号