rows = driver.find_element_by_xpath("//div[@style='display: block;']//table[@style='display: table;']//tr")
When I try to iterate over rows It throws an error TypeError: 'WebElement' object is not iterable
def get_size(e):
for entry in e:
count = count + 1
return count
get_size(rows)
type
will tell you the type of the object (Well, actually, you already know it's aWebElement
.) anddir
will help you figure out what methods are available. That might be a good place to start.find_element_by_xpath()
returns a single result. You needfind_elements_by_xpath()
if you want a collection of results.