-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
23 lines (16 loc) · 763 Bytes
/
conftest.py
File metadata and controls
23 lines (16 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pytest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
def pytest_addoption(parser):
parser.addoption('--language', action='store', default='en', help='Choose language')
@pytest.fixture(scope="function")
def browser(request):
user_language = request.config.getoption('language')
options = Options()
options.add_experimental_option('prefs', {'intl.accept_languages': user_language})
browser = webdriver.Chrome(options=options, service=ChromeService(ChromeDriverManager().install()))
browser.implicitly_wait(5)
yield browser
browser.quit()