0
votes

I am trying to send_keys to this input :

<input id="textfield-1017-inputEl" data-ref="inputEl" type="text" size="1" name="search" placeholder="Find Bunker.." aria-hidden="false" aria-disabled="false" role="textbox" aria-invalid="false" aria-readonly="false" aria-describedby="textfield-1017-ariaStatusEl" aria-required="false" class="searchfield x-form-text x-form-text-default  x-form-empty-field x-form-empty-field-default" autocomplete="off" data-componentid="textfield-1017">

but I am always getting this error :

Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="textfield-1017-inputEl"]"} (Session info: chrome=80.0.3987.163)

I am using selenium in python , and this is the code I am using :

find_my_input = browser.find_element_by_id('textfield-1017-inputEl')
2

2 Answers

0
votes

Try below solution:

wait = WebDriverWait(driver, 30)
iframe= wait.until(EC.presence_of_element_located((By.ID, "ext-gen1099")))
driver.switch_to.frame(iframe)

element= WebDriverWait(driver, 30).until(
                EC.element_to_be_clickable((By.ID, "textfield-1017-inputEl")))

Note : please add below imports to your solution

from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
0
votes

Make sure you wait for the element to be loaded using the explicit wait as shown below.

Imports needed:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

change the code to the below.

find_my_input = WebDriverWait(browser,30).until(EC.presence_of_element_located((By.ID,"textfield-1017-inputEl")))

If element is present in the iframe then you have to switch to the iframe first and then access the element.

driver.switch_to.frame('id/name goes here')
find_my_input = WebDriverWait(browser,30).until(EC.presence_of_element_located((By.ID,"textfield-1017-inputEl")))