Python - How to get Selenium send_keys to work in IE11 Python - How to get Selenium send_keys to work in IE11 selenium selenium

Python - How to get Selenium send_keys to work in IE11


First, add waits:

from selenium.webdriver.support.wait import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.common.by import Bywait = WebDriverWait(driver, 30)wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'input[name="ctl00$cphMain$txtAgency"]')))

Then try:

search = driver.find_element_by_css_selector('input[name="ctl00$cphMain$txtAgency"]')search.click()search.send_keys('%')

Or,

search = driver.find_element_by_css_selector('input[name="ctl00$cphMain$txtAgency"]')search.clear()search.send_keys('%')

IE is always pain to automate.


Your code is right. I test and find that if we run the python code as administrator, it can run well in IE.

You can first run cmd as administrator like below and then navigator to the path of your py file and run the command:

python yourfile.py

enter image description here