Solving `'WebElement' object is not subscriptable` in Python

See here for the original answer.

The problem is your use of the find_element method, because afterwords you attempt to access an index of the variable, when it is a single element in length.

What you are looking for is the find_elements command, which will return a list from which you can select individual elements. For more information, see the Selenium documentation on this topic here.


Tags

  1. python (Private)
  2. selenium (Private)
  3. stack-overflow (Private)
  4. answer (Private)