bot_base.py 文件源码

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

项目:qacode 作者: netzulo 项目源码 文件源码
def mode_local(self):
        """Open new brower on local mode"""
        browser_name = self.bot_config.config['browser']
        if browser_name == "chrome":
            self.curr_caps = DesiredCapabilities.CHROME.copy()
            self.curr_driver = WebDriver.Chrome(
                executable_path=self.curr_driver_path,
                desired_capabilities=self.curr_caps
            )
        elif browser_name == "firefox":
            self.curr_caps = DesiredCapabilities.FIREFOX.copy()
            self.curr_driver = WebDriver.Firefox(
                executable_path=self.curr_driver_path,
                capabilities=self.curr_caps
            )
        elif browser_name == "iexplorer":
            self.curr_caps = DesiredCapabilities.INTERNETEXPLORER.copy()
            self.curr_driver = WebDriver.Ie(
                executable_path=self.curr_driver_path,
                capabilities=self.curr_caps
            )
        elif browser_name == "edge":
            self.curr_caps = DesiredCapabilities.EDGE.copy()
            self.curr_driver = WebDriver.Edge(
                executable_path=self.curr_driver_path,
                capabilities=self.curr_caps
            )
        elif browser_name == "phantomjs":
            self.curr_caps = DesiredCapabilities.PHANTOMJS.copy()
            self.curr_driver = WebDriver.PhantomJS(
                executable_path=self.curr_driver_path,
                desired_capabilities=self.curr_caps
            )
        elif browser_name == "opera":
            self.curr_caps = DesiredCapabilities.OPERA.copy()
            self.curr_driver = WebDriver.Opera(
                executable_path=self.curr_driver_path,
                desired_capabilities=self.curr_caps
            )
        else:
            raise CoreException(
                message=("config file error, SECTION=bot, KEY=browser isn't "
                         "valid value: {}".format(browser_name)),
                log=self.log
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号