next_btn = driver.find_element_by_xpath(“//a[@class=’ge-49M’]”)
for i in next_btn:
driver.get(i)
lnks = driver.find_elements_by_xpath(“//a[@class=’_2UzuFa’]”)
for z in lnks:
href_new.append(z.get_attribute(‘href’))
Here I am trying to retrieve all the links present in every page like(1,2,3,4,5) and from these links I want to retrieve the links of the products.
TypeError Traceback (most recent call last)
<ipython-input-118-b4d6c76aecdf> in <module>
1 next_btn = driver.find_element_by_xpath(“//a[@class=’ge-49M’]”)
—-> 2 for i in next_btn:
3 driver.get(i)
4 lnks = driver.find_elements_by_xpath(“//a[@class=’_2UzuFa’]”)
5 for z in lnks:
TypeError: ‘WebElement’ object is not iterable
But it’s throwing this error.
Source: Read More