Reputation: 1
I am trying to write a automation test using selenium and python webdriver
class UserAccountsTest(unittest.TestCase):
def setup(self):
self.driver=webdriver.Firefox()
def testFirstUser(self):
driver = self.driver
driver.implicitly_wait(15)
driver.get('website.com')
driver.implicitly_wait(15)
My error: object has no attribute 'driver' Im not sure why I can't assign driver to self.driver. Am I passing in self correctly?
Upvotes: 0
Views: 67
Reputation: 1128
You need to call your setup()
function setUp()
as described in unittest wiki.
Luckily, we can factor out such set-up code by implementing a method called setUp(), which the testing framework will automatically call for us when we run the test
Upvotes: 2