'selenium.common.exceptions.TimeoutException error using send_keys() from Selenium Python
getting the error of timeout, tried to increase the time to 20, I see the page loading but still get the error and cannot see the email inserted to the field.
Code trials:
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, 'input]'))
)
driver.find_element(By.XPATH, '//input[@class=input]').send_keys('[email protected]')
What is the problem?
Solution 1:[1]
Try this
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, 'input]'))
element.sendKeys('[email protected]')
or
element = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.CLASS_NAME, 'input]'))
element.sendKeys('[email protected]')
Solution 2:[2]
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 the following locator strategy:
Using XPATH:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//input[@class="input"]'))).send_keys("[email protected]")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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Akzy |
| Solution 2 | undetected Selenium |
