Reputation: 116333
I'm using .find_element_by_class_name()
to get an element with a given class name. It seems that the returned element is the first with the class name. How can I get the n'th element with that class name?
Also, is it possible to get all the DOM elements with a given class name?
Upvotes: 2
Views: 2320
Reputation: 73332
There is a find_elements_by_class_name,
notice the elements (plural) method which returns an iterator. To find the n'th element simply replace num
: find_elements_by_class_name('className')[num]
This should return all DOM elements with the same class name.
Upvotes: 2