-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
33 lines (25 loc) · 997 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
26
27
28
29
30
31
32
import pytest
from selenium import webdriver
import os
from selenium.webdriver.chrome import service
import time
import warnings
@pytest.fixture(scope="session")
def browser():
#disable DeprecationWarning
warnings.filterwarnings("ignore", category=DeprecationWarning)
# set up the path to operadriver executable
webdriver_service = service.Service(os.path.abspath("driver/operadriver.exe"))
webdriver_service.start()
options = webdriver.ChromeOptions()
# set up path to Opera browser executable
options.binary_location = r"C:\Users\Starosta\AppData\Local\Programs\Opera\opera.exe"
options.add_experimental_option('w3c', True)
driver = webdriver.Remote(webdriver_service.service_url, options=options)
# Set up specific site to visit
starting_page = "https://cashback.opera.com/pl/en"
driver.get(starting_page)
driver.maximize_window()
time.sleep(1)
yield driver # Provide the WebDriver instance to the test
driver.quit()