TypeError:必须使用className实例作为第一个参数调用unsbound方法navigate_to_page()(改为使用str实例)

时间:2016-01-18 07:39:36

标签: python-2.7 selenium-webdriver

这是我的Python代码:

class SearchTest(BaseTestCase,unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        super(SearchTest, cls).setUpClass()
        cls.navigate_to_page(keyword_Constants['URL'])

    def test1_Search(self):
        homepageObj= HomePage(self.driver)
        homepageObj._verifypage()
        searchObj = SearchPage(self.driver)
        searchField = searchObj.searchKeyword("chicken")

    def test2_CountSearchResultVal(self):
        searchObj = SearchPage(self.driver)
        #searchField = searchObj.countSearchResultVal("chicken")

    @classmethod
    def tearDownClass(cls):
        super(SearchTest, cls).tearDownClass()

if __name__ == "__main__":
    unittest.main(verbosity=2)    

当我尝试使用此类方法时,弹出以下错误:

TypeError: unbound method navigate_to_page() must be called with SearchTest instance as first argument (got str instance instead).

0 个答案:

没有答案