Code trials:
voucher_input = WebDriverWait(driver, 10).until(EC.presence_of_element_located ((By.NAME, "voucher")))
I tried changing the name for input field in code still didn't fix it
Code trials:
voucher_input = WebDriverWait(driver, 10).until(EC.presence_of_element_located ((By.NAME, "voucher")))
I tried changing the name for input field in code still didn't fix it
Assuming the relevant HTML of the element being:
<input name="voucher" ...>
To send a character sequence to the element instead of presence_of_element_located() you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:
Using NAME:
voucher_input = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.NAME, "voucher")))
Using CSS_SELECTOR:
voucher_input = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='voucher']")))
Using XPATH:
voucher_input = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='voucher']")))
Note: You have to add the following imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
After locating the input field, you can use the send_keys() method to input text into it.
voucher_input = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.NAME, "voucher")))
voucher_input.send_keys("your text here")