Closed Tushar7337 closed 4 months ago
this is the wrong issue tracker for this question
based on the screenshot you named the local plugin wrong (coftest.py
instead of conftest.py
)
@RonnyPfannschmidt Thanks a lot it works after refactoring file name.
Working on one selenium script using pyTest framework but while passing setup and teardown method from conftest.py file getting error
PFA script for reference
@pytest.mark.usefixtures("setup_and_teardown") class TestSearch: def test_search_for_a_valid_product(self): self.driver.find_element(By.NAME, "search").send_keys("HP") self.driver.find_element(By.XPATH, "//button[contains(@class,'btn-default')]").click() assert self.driver.find_element(By.LINK_TEXT, "HP LP3065").is_displayed()
@pytest.fixture() def setup_and_teardown(request): driver = webdriver.Chrome() driver.maximize_window() driver.get("https://tutorialsninja.com/demo/") request.cls.driver = driver yield driver.quit()
All error are getting to self.driver as to minimize the code delicacy I have written setup and teardown function in conftest.py file `