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
)
评论列表
文章目录