-
Notifications
You must be signed in to change notification settings - Fork 30
/
conftest.py
25 lines (19 loc) · 828 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pytest
def pytest_addoption(parser):
parser.addoption("--browser", action="store", default="chrome", help="Type in browser name e.g. chrome OR firefox")
@pytest.fixture(scope="class")
def test_setup(request):
from selenium import webdriver
browser = request.config.getoption("--browser")
if browser == 'chrome':
driver = webdriver.Chrome(
executable_path="C:/Users/Administrator/PycharmProjects/AutomationFramework_1/drivers/chromedriver.exe")
elif browser == 'firefox':
driver = webdriver.Firefox(executable_path="C:/Users/Administrator/PycharmProjects/AutomationFramework_1/drivers/geckodriver.exe")
driver.implicitly_wait(5)
driver.maximize_window()
request.cls.driver = driver
yield
driver.close()
driver.quit()
print("Test Completed")