0

Code:

from selenium import webdriver
import webbrowser

driver = webdriver.Chrome(r"C:\Users\nafi.DESKTOP-Q4U6HNF\Desktop\chromedriver.exe")

driver.get("https://www.youtube.com")


driver.find_element_by_css_selector("ytd-searchbox").send_Keys("venom")

driver.find_element_by_css_selector("search-icon-legacy > yt-icon").click()

main()

Error:

AttributeError: 'WebElement' object has no attribute 'send_Keys'

2 Answers 2

1

Please use 'send_keys'(All alphabets in small case) and not 'send_Keys'.

eg. element.send_keys("some text")

Sign up to request clarification or add additional context in comments.

Comments

0

Send keys will work on input fields. You are trying to send keys on ytd-searchbox which will not work.

try send keys on following element

driver.find_element_by_xpath("//input[@id='search']").send_Keys("venom")

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.