Selenium Webdriver - Keys not being sent to search boxes

Viewed 18

I am starting to use Selenium Webdriver (Chrome) and while pages open automatically keys are not being sent for some reason. For example, I open google.com, and I use a "BY.ID" to aim at the search box by it's ID and send "Hi" but for some reason, it doesn't send the keys, I tried looking at the Selenium documentation but It kinda left me more confused, anybody knows why keys aren't being sent? Thanks in advance!

from selenium import webdriver
from selenium.webdriver.common.by import By

browser = webdriver.Chrome('/Users/thras/Desktop/Chromedriver/chromedriver')

browser.get('https://www.youtube.com')

title = browser.title

browser.implicitly_wait(3)

text_box = browser.find_element(By.ID,"search").send_keys('Hi')
1 Answers
from selenium import webdriver
from selenium.webdriver.common.by import By

browser = webdriver.Chrome('/Users/thras/Desktop/Chromedriver/chromedriver')

browser.get('https://www.google.com')

title = browser.title

browser.implicitly_wait(3)

text_box = browser.find_element(By.NAME, value="q")
text_box.send_keys('Hiii')

fixed, it was syntax issue it seems, I needed to add "value" before the actual ID

Related