-2
任何人都可以請指出什麼是錯在哪我已經實現如下:「NoneType」對象有沒有屬性「功能」
def setUp(self):
self.driver = selenium.webdriver.Chrome()
self.page = self.driver.get("http://mywebsite/form")
self.page.search_trip(2, 2)
def search_trip(self, depart, arrival):
departing = Element(Locators.XPATH, "//select[@name='departing']/option[@value='%i']" %depart)
returning = Element(Locators.XPATH, "//select[@name='returning']/option[@value='%i']" %arrival)
search = Element(Locators.XPATH, "//input[@type='submit']")
self.departing.click()
self.returning.click()
self.search.submit()
錯誤代碼:
self.page.search_trip(2, 2)
AttributeError: 'NoneType' object has no attribute 'search_trip'
你至少應該與打印 –
你爲什麼要假定'driver.get'返回一些調試代碼? – DeepSpace