forked from startrug/selenium-python-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver_factory.py
More file actions
18 lines (15 loc) · 725 Bytes
/
Copy pathdriver_factory.py
File metadata and controls
18 lines (15 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager
class DriverFactory:
@staticmethod
def get_driver(browser):
if browser == "chrome":
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
return webdriver.Chrome(ChromeDriverManager().install(), options=options)
elif browser == "firefox":
options = webdriver.FirefoxOptions()
options.add_argument("start-maximized")
return webdriver.Firefox(executable_path=GeckoDriverManager().install(), options=options)
raise Exception("Provide valid driver name")