Reputation: 573
I want to use the selenium module for python 3 to get some information from a website, that information is located in a class with the name "table_dark_green". Now the problem is that there are multiple elements on this site with the class name "table_dark_green", and selenium only stores the last element with that class name. Is there a way to specify which one i would like to use?
Upvotes: 0
Views: 52
Reputation: 5204
You can use find_elements
then specify the element:
# this returns a list of elements
table_elements = driver.find_elements_by_class_name("table_dark_green")
print(len(table_elements)) # print to see how meny elements are in he list
# you can specify the element in the list[0] or [1] ... [99]
print(table_elements[0].text)
Hope this helps you!
Upvotes: 1