im new to writing automated tests and I feel like I am definitely missing something very obvious
Here is my code.
Class BIIAccountPreferencesTest(CoreTest):
def testAccountPreferences(self):
lp = BIILoginPage(self.driver)
hp = lp.biiLoginUser(config.biisubscriber_username , config.biisubscriber_password)
d = self.driver
print "\n Changing user and company name"
d.get(config.bii_url + '/account')
d.find_element_by_css_selector('#user-fullname').clear()
d.find_element_by_css_selector('#user-company').clear()
d.find_element_by_css_selector('#user-fullname').send_keys(random.choice(string.ascii_uppercase) for x in range(7))
d.find_element_by_css_selector('#user-company').send_keys(random.choice(string.ascii_uppercase) for x in range (5))
d.find_element_by_css_selector('#user-Save').click()
a = d.find_element_by_css_selector('body > div.container.clearfix > p').text
b = "Your account information has been updated"
self.assertTrue(str(b) in str(a))
When I run this code it keeps throwing me this error "NameError: name 'd' is not defined" Am I not declaring d = self.driver at the right moment? I use self.driver since im running this through saucelabs
Your code is mixing tab and spaces and it's not considered indented as you think it is.
Just set up your editor to avoid tab characters completely (decent editors can do this and still use the tab key for indentation).