def get_selenium_driver(browser_name: str) -> Union[Chrome, Firefox]:
"""
Return the same instance to the Selenium driver.
:param browser_name: the name of the browser: chrome or mozilla
:type browser_name: str
:return: an instance of the required driver.
:rtype: Union[Chrome, Mozilla]
"""
if browser_name.upper() == 'CHROME':
return SingletonFactory.build(Chrome)
elif browser_name.upper() == 'Mozilla':
return SingletonFactory.build(Firefox)
else:
raise NotImplementedError
评论列表
文章目录