So I have this test and fixture:
@pytest.fixture()
def init_driver():
return webdriver.Chrome(executable_path=TestParams.CHROME_EXECUTABLE_PATH)
@pytest.mark.usefixtures('init_driver')
def test_1():
driver = init_driver
login(driver)
In this case my driver type is <class 'function'> so I cannot use its function for example get and got this error:
AttributeError: 'function' object has no attribute 'get'
When I change it to this:
@pytest.mark.usefixtures('init_driver')
def test_1():
login(webdriver.Chrome(executable_path=TestParams.CHROME_EXECUTABLE_PATH))
My driver type is <selenium.webdriver.chrome.webdriver.WebDriver (session="4ca3cb8f5bcec7a7498a65bfe5a2ea81")>
And all works fine.
What I am doing wrong ?