Python Forum
Object not Subscriptable - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Object not Subscriptable (/thread-25095.html)



Object not Subscriptable - AgileAVS - Mar-19-2020

Help post:
How do you select the second or third element with the same class name while using selenium?
For instance,
Trial=browser.find_element_by_class_name(‘indicator-diamond’)[1]

Output: TypeError: ‘WebElement’ object is not subscriptable


RE: Object not Subscriptable - ndc85430 - Mar-21-2020

Have you looked at the docs? The methods for finding that return multiple elements have "element" as plural (i.e. find_elements_by_class_name for you).


RE: Object not Subscriptable - wademozybozy - Oct-08-2021

(Mar-21-2020, 02:18 PM)ndc85430 Wrote: Have you looked at the docs? The methods for finding that return multiple elements have "element" as plural (i.e. find_elements_by_class_name for you).

thank you sir