0

Im trying to open up the link in my code , locate where it asks me to enter my email address and then enter in my email address and finally press enter. However I am getting an attribute error: 'list' object has no attribute 'send_Keys' and have no idea why.

Here is my code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

PATH = "/Users/Monkeys/Downloads/chromedriver"
driver = webdriver.Chrome(PATH)

driver.get("https://www.mytutor.co.uk/tutors/login/")
search = driver.find_elements_by_name("form:email:input")
search.send_keys("[email protected]")
search.send_Keys(Keys.RETURN)

driver.quit()

I have tried to find the element in other ways still getting the same error. I thought I had issues locating the element in the HTML code but that wasn't the issue. I simply have no idea what the attribute error in this context means. I would appreciate if I could get some assistance please.

1
  • 2
    driver.find_elements_by_name will return a list. Either select the element you want in the list e.g. search[0].send_keys or use driver.find_element_by_name (no s) Commented Jun 7, 2021 at 16:48

1 Answer 1

3
driver.find_elements_by_name("form:email:input")

will return a list not a single web element. so search is a list in your case not a web element.

send_keys 

from selenium is meant for WebElement.

use find_element instead that will return a WebElement not list of web elements.

search = driver.find_element_by_name("form:email:input")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.