browser_mgmt.py 文件源码

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

项目:warriorframework 作者: warriorframework 项目源码 文件源码
def _make_ff(self, webdriver_remote_url, desired_capabilites, profile_dir,
                 binary, gecko_path):
        """Create an instance of firefox browser"""
        try:
            if webdriver_remote_url:
                browser = self._create_remote_web_driver(
                        webdriver.DesiredCapabilities.FIREFOX,
                        webdriver_remote_url, desired_capabilites,
                        profile_dir)
            else:
                ff_capabilities = webdriver.DesiredCapabilities.FIREFOX
                if ff_capabilities['marionette']:
                    ff_capabilities['acceptInsecureCerts'] = True
                    ffbinary = FirefoxBinary(binary)
                    browser = webdriver.Firefox(firefox_binary=ffbinary,
                                                firefox_profile=profile_dir,
                                                executable_path=gecko_path)
                else:
                    browser = webdriver.Firefox(firefox_profile=profile_dir)
            return browser
        except WebDriverException as e:
            if "executable needs to be in PATH" in str(e):
                print_error("Please provide path for geckodriver executable")
            elif "Expected browser binary location" in str(e):
                print_error("Please provide path of firefox executable")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号