Sometimes_me
Sometimes_me

Reputation: 31

Clicking on mails Selenium

I need help in using selenium driver to click on that mail. I've tried and tried and I'm only getting errors.

I've done this:

driver.find_elements_by_partial_link_text("Email Test").click() 

but got error:


AttributeError: 'list' object has no attribute 'click'

Location of he element

enter image description here

Upvotes: 1

Views: 46

Answers (1)

wasif
wasif

Reputation: 15480

Here find_elements_* will give a list of all found elements, where find_element_* will return only the first find. So try:

driver.find_element_by_partial_link_text("Email Test").click() 

Otherwise, if you want to iterate over the list and click all:

for link in driver.find_elements_by_partial_link_text("Email Test"):
  link.click()

Upvotes: 1

Related Questions