skip to Main Content

Facing "TypeError: object of type 'WebElement' has no len()" while executing the below script – Magento

Iam trying to check whether the product is 12 or not by using assert equal function.Please check the below script i have tried: def test_search(self): driver=self.driver driver.get("http://magento-demo.lexiconn.com/") driver.maximize_window() driver.find_element_by_xpath(".//*[@id='search']").send_keys("Bed & Bath") driver.find_element_by_xpath(".//*[@id='search_mini_form']/div[1]/button").click() lis = driver.find_element_by_xpath("//h2[@class='product-name'] / a") self.assertEqual(12,len(lis))

VIEW QUESTION
Back To Top
Search