I created a session-scoped fixture so that my webdriver will be consistent with all tests (the browser won't close between tests), but for some reason, I am getting an error from within each test that "self" doesn't have the specified member.
The code itself works, but all of these errors make it hard to follow what is a real error and what is not.
I'm using vscode and the default python linter.
Does anyone know how to avoid these error messages without losing the capabilities of the linter itself?
All code is running in pipenv as well.
conftest.py
import pytest
@pytest.fixture(scope="session", autouse=True)
def driver_get(request):
from selenium import webdriver
web_driver = webdriver.Chrome()
session = request.node
for item in session.items:
cls = item.getparent(pytest.Class)
setattr(cls.obj,"driver",web_driver)
yield
web_driver.close()
test_file.py
import pytest
class TestLogin:
def testPageload(self):
wait = WebDriverWait(self.driver, 3)
self.driver.get('https://www.website.com')
The error that appears on all "self" references is:
Instance of 'TestLogin' has no 'driver' member pylint(no-member)