I have written code something similar to below code to achieve my requirement, but I am getting error message.
class Test(BaseSetup):
def test_01_create_record(self):
--
def test_02_edit_record(self):
--
def test_03_delete_record(self):
--
def test_04_verify_item_tab(self):
testObj=Test()
testObj.test_01_create_record()
do this....
testObj.test_03_delete_record()
if __name__ == '__main__':
unittest.main()
Here all above three test method(test_01, test_02 and test_03) runs well, but last test, i.e test_04 fails. It is not able to create the record using test_01(though it works well separately). I am getting below error message for my last test.
self.driver.find_element_by_xpath(self.content_tab_xpath).click()
AttributeError: 'NoneType' object has no attribute 'find_element_by_xpath'
The above error message is for first test(test_01_create_record), I get only when I call first test method from another test, but when I runs it separately it works well. Any idea what I might be missing? Many thanks
No need to create instance of your class inside it, just reference to the instance with self
:
def test_04_verify_item_tab(self):
self.test_01_create_record()
self.test_03_delete_record()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With