Reputation: 11
Please help, I am new to python and now getting below error
"TypeError: unbound method assertEqual() must be called with ExampleScript14 instance as first argument (got str instance instead)"
for the below code:
from selenium import webdriver from selenium.webdriver.common.by import By import unittest import time import variables from time import sleep
class ExampleScript14(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(ExampleScript14, cls).setUpClass()
cls.driver = webdriver.Chrome()
cls.driver.get(cls.url)
cls.test_click_the_username()
@classmethod
def test_click_the_username(self):
# Click the USer name
self.driver.find_element_by_link_text(variables.USER_NAME).click()
# click the Edit button
self.driver.find_element_by_id("btnSave").click()
print "Verify Edit button changed to Save button"
element = self.driver.find_element_by_id("btnSave")
element_attribute = element.get_attribute("value").encode('utf8')
print "attr:", type(element_attribute)
print "The button value is:", element_attribute
self.assertEqual("Save", element_attribute)
if __name__ == "__main__":
unittest.main()
Upvotes: 0
Views: 309
Reputation: 10284
You test_click_the_username
should not be a classmethod
. Just delete @classmethod
decorator and it should work.
Upvotes: 1