Because you are using find_elements_by_xpath
, not find_element_by_xpath
, note your one is plural elements
, while the other one is element
.
driver.find_elements_by_xpath
will return a list of elements, text
is a property for a single element. You need either use find_element_by_xpath
, or index find_elements_by_xpath
.
AttributeError: 'list' object has no attribute 'text'
has clearly told you that.
Furthermore, the title you mean is the attribute of the element, so need this
imageTitle= driver.find_element_by_xpath("//td[2]/div/img").get_attribute("title")
Here is the API documentation, please read carefully when coding.