• Register
1 vote


Hello guys,
I have a chunk of python code where I am trying to extract all the links from a particular website. For that, I am using selenium.webdriver.

But the program is not retrieving the links from that website as I am expecting. Instead of that, it is throwing an error typeerror: 'webelement' object is not iterable

Here is the sample code snippet of mine:

import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

for ii in search:

Why I am getting this error? I have no idea about this. Do you guys pop up the error from it and help me to fix the problem? I really appreciate your help in this regard. It took already much times from me but couldn't find any way.

Thanks a lot.

12 7 7
15,250 points

Please log in or register to answer this question.

1 Answer

1 vote
Best answer


To become a good programmer it is mandatory to have a keen eye to find the problem from own codes at least. If you have had a close look you may able to find the problem. The compiler always sends the error message with hints. Well, the 'webelement' object is not iterable error is a type-error. It occurs due to misspelling in a program. In your case, you wrote find_element_by_xpath, what does that mean actually? You were supposed to get multiple links for a website but find_element_by_xpath is not able to get that because it is not iterable. That’s the reason your program encountering the error. To fix the error, write the line correctly.


This line is iterable and gets all the links from your asking webpage.


13 9 6
94,260 points

Related questions

0 votes
1 answer 30 views
Problem: Why this keep shown to me: Typeerror: 'webelement' object is not iterable
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 6 views
Problem: I created a method called public void campoRechamada inside this method i tryed store a Datepicker inside a List , but the Eclipse show me the following message error:The type List is not generic; it cannot be parameterized with arguments I do not know why the ... { Thread.sleep(1200000); SairPagina sair = new SairPagina(driver); sair.sairBkoMais(); Thread.sleep(1000); driver.quit(); } }
asked Apr 25 ochena 23.3k points
0 votes
1 answer 164 views
Problem: this error came up: File "C:\temp\gssm_arcpy.1.0.3.py", line 147, in AnalyzeSightLine for index,point in slX: TypeError: 'numpy.float64' object is not iterable
asked Mar 16 ummesalma 29.2k points
0 votes
1 answer 14 views
Problem: How to solve this, any help: TypeError: 'function' object is not iterable
asked Mar 15 Wafa Abu Yousef 6.1k points
0 votes
1 answer 23 views
Problem: How to I Solve this: python typeerror: 'nonetype' object is not iterable HELP! I need help understanding this: python typeerror: 'nonetype' object is not iterable Can someone please help solve this, I am new in python(). Someone have idea to solve this thanks!
asked Mar 3 Mashhoodch 13k points
0 votes
1 answer 26 views
Problem: I am looking to make a loop so that for each element in the list, it will get broken down into each of it's characters. For example, say the number 137 was in the list then it would be turned into [1,3,7]. Then I want to add these numbers together (I ... it). However, I keep getting the error message TypeError: 'int' object is not iterable when I try and run this. What am I doing wrong?
asked Feb 23 Mashhoodch 13k points
0 votes
1 answer 91 views
Problem: What the traceback error is pointing out is the misuse of for statement: for i in Updt():. for in python 3 i "Python's for statement iterates? How function' object is not iterable. from getWords import getWords unique = [] def findUniqueWords(words): for word in words
asked Feb 15 Mashhoodch 13k points
0 votes
1 answer 39 views
Problem: I am getting this error when trying to clear the JSON data, save it to another JSON file and finally convert it to a CSV file: for data1 to n: TypeError: int object is not repeated This is my code: import json import csv with open('leap_data.json') as f:     data = ... .writerow(data_1[0].keys()) for row in data_1:         output.writerow(row.values()) Please tell me how to get rid of it.
asked Nov 5, 2020 Han Li 710 points
1 vote
1 answer 536 views
Problem: When I run or compile this program import urllib2 import time import datetime HolaAndre = 'HUA','WALT','NOKA','CMG','EVAL','DARZ','SYM' def BackData(stock): try: print 'Still pulling',stock print str(datetime.datetime.fromtimestamp(time. ... BackData(eachStock) It shows me the following error main loop 'builtin_function_or_method' object is not iterable What is the problem please help me.
asked Apr 5, 2020 LizzyM 6.1k points
0 votes
1 answer 134 views
Problem: So I'm trying to download a certain link of a webpage but each time i run the code i get an AttributeError: 'Webdriver' object has no attribute 'findElement'. I'm using selenium and python. here is my code import selenium from selenium import web driver ... 'm trying to take link from") driver.findElement(By.partialLinkText("DEV.tgz") Can anybody help me to why I am getting this error
asked Apr 6 nabin 4.6k points