driver find elements by css selector input placeholder from send keys del AttributeError list object has no attribute send keys

0 votes
from selenium import webdriver

driver = webdriver.Chrome(executable_path="c:\\chromedriver.exe")
driver.get("https://www.edureka.co/")
driver.find_element_by_id("fromCity").click()
driver.find_elements_by_css_selector("input[placeholder='from']").send_keys("del")
cities = driver.find_elements_by_css_selector("p[class*='blacktext']")
for city in cities:
    if city.text == "Del Rio, United States":

This is my code. I am getting error as

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

May 20, 2020 in Python by Nupur
• 120 points

edited May 20, 2020 by Gitika 4,811 views

1 answer to this question.

0 votes

Hey, @Nupur,

You are getting a list of web elements with

driver.find_elements_by_css_selector("input[placeholder='from']").send_keys("del")
cities = driver.find_elements_by_css_selector("p[class*='blacktext']")

instead of that use this

driver.find_element_by_css_selector("input[placeholder='from']").send_keys("del")
cities = driver.find_element_by_css_selector("p[class*='blacktext']")

I hope this will help.

answered May 20, 2020 by Gitika
• 65,770 points

Related Questions In Python

0 votes
1 answer

Getting AttributeError: 'module' object (scipy) has no attribute 'misc' in Python. How to solve this?

>>> import scipy >>> scipy.misc Traceback (most recent call ...READ MORE

answered Dec 24, 2018 in Python by Nymeria
• 3,560 points
9,435 views
0 votes
1 answer
0 votes
2 answers

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

Try this: data=pd.read_csv('/your file name', delim_whitespace=Tru ...READ MORE

answered Dec 10, 2020 in Python by anonymous
• 82,840 points
132,586 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'mainloop'" python module turtle

Hey @Nagya, replace  wn.mainlopp() with turtle.mainloop() ...READ MORE

answered Jun 19, 2019 in Python by Faiza
7,254 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,438 views
0 votes
1 answer
0 votes
1 answer

AttributeError: type object 'DataFrame' has no attribute 'from_items'

Hi, @Bronson, You can go through this, I ...READ MORE

answered Apr 6, 2020 in Python by Gitika
• 65,770 points
5,314 views
0 votes
3 answers

AttributeError: 'numpy.ndarray' object has no attribute 'append'

for root, dirs, files in os.walk(directory): ...READ MORE

answered Dec 12, 2020 in Python by Rajiv
• 8,870 points
52,895 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP