-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
38 lines (35 loc) · 1.28 KB
/
conftest.py
File metadata and controls
38 lines (35 loc) · 1.28 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
import pytest
from selenium import webdriver
from utilities.testdata import TestData
"""
Fixture to open the browser instance for each test case.
"""
@pytest.fixture(params=["chrome", "firefox", "edge"])
def initialize_driver(request):
if request.param == "chrome":
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--disable-notifications')
options.add_argument('--no-sandbox')
options.add_argument('--verbose')
options.add_argument('--disable-gpu')
options.add_argument('--disable-software-rasterizer')
driver = webdriver.Chrome(options=options)
elif request.param == "firefox":
options = webdriver.FirefoxOptions()
options.add_argument('--headless')
options.add_argument('--verbose')
driver = webdriver.Firefox(options=options)
elif request.param == "edge":
options = webdriver.EdgeOptions()
options.add_argument('--headless')
options.add_argument('--verbose')
driver = webdriver.Edge(options=options)
driver.implicitly_wait(5)
request.cls.driver = driver
# print("Browser: ", request.param)
driver.get(TestData.url)
driver.maximize_window()
yield
# print("Close Driver")
driver.close()