I have a following fixture defined in conftest.py:
@pytest.fixture(scope="class")
def driver_init(request):
chrome_driver = webdriver.Chrome(PATH)
request.cls.driver = chrome_driver
yield
chrome_driver.close()
I want to create another fixture called access in that file that is using the driver from the above one and I tried to do it by:
@pytest.fixture
def access(driver_init):
#do sth
@pytest.fixture
@pytest.mark.usefixtures(driver_init)
def access():
# do sth
However in both cases I'm unable to call driver (it is not visible). Could you please help me understand on what I'm doing wrong?
Or in what other way can I ensure that I can use webdriver in other fixtures?
Aucun commentaire:
Enregistrer un commentaire