Issue
I've been working with this online form and having no problems getting Selenium to click() or send_keys() on other elements. But one element (the "Notes" textarea toward the end of the form) is giving me a TimeoutException, even when I give it a WebDriverWait and the element is clearly present on the page.
Anyone know what's going on? I just want to send_keys() to it, but I've tried also click() first then send_keys(); I'm consistently getting the TimeoutException.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("detach", True)
webdriver = webdriver.Chrome(options=chrome_options)
webdriver.get("https://lincdoc.ou.edu/lincdoc/doc/run/ouathletics/OU_AdvisingForm2#ldTimeoutUri")
WebDriverWait(webdriver, 5).until(ec.presence_of_element_located((By.CSS_SELECTOR, "input[id$='8e']"))).send_keys("hi")
Solution
@nocryinginprogramming your code is fine except that the element is textarea
instead of input
in your CSSSelector. The following line should work as per your expectation.
WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, "textarea[id$='8e']"))).send_keys("hi")
Answered By - ketanvj
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.