While running the below code getting error " NoneType' object has no attribute 'get' "
TestProductRecogic.py:
import unittest
from PageObject.ProductRcognic import ProductPage
import pytest
class TestProductRecognic(unittest.TestCase):
@pytest.fixture(autouse=True)
def classSetup(self, setup):
self.driver = setup
def test_Product(self):
self.driver.get("https://www.recognic.ai/")
self.ep = ProductPage(self.driver)
self.ep.clickOnProduct()
def tearDown(self):
self.driver.close()
CodePudding user response:
Ensure that your setup
is returning the driver instance.
You would need to have a setup fixture which looks somewhat like this:
@pytest.fixture()
def setup():
driver = webdriver.Chrome(path) #example
return driver
class TestProductRecognic(unittest.TestCase):
@pytest.fixture(autouse=True)
def classSetup(self, setup):
self.driver = setup
def test_Product(self):
self.driver.get("https://www.recognic.ai/")
self.ep = ProductPage(self.driver)
self.ep.clickOnProduct()
def tearDown(self):
self.driver.close()