I am trying to enter text in “keywords” section using send keys command. Please find my below code.
from selenium import webdriver driver=webdriver.Chrome(executable_path="C:Program Files (x86)Driverschromedriver.exe") driver.get("https://www.antal.com/job-search") driver.maximize_window() time.sleep(10) driver.find_element(By.ID,'keywords').send_keys("testing")
Advertisement
Answer
There are two elements with same id
I used driver.find_elements_by_id("keywords")
method to get all of them as a list
and i accessed the required using index number
from selenium import webdriver import time driver=webdriver.Chrome(executable_path="chromedriver.exe") driver.get("https://www.antal.com/job-search") driver.maximize_window() elements = driver.find_elements_by_id("keywords") ele = elements[1] ele.send_keys("test")