0

I'm trying to enter some text into a field, it works for the first time but after that, it shows this error! ElementNotInteractableException I don't know why! here you are my code:

try:
    browser.execute_script("window.scrollBy(0,600)", "")
    WebDriverWait(browser, 60).until(EC.visibility_of_element_located((By.XPATH, path)))
    comment = browser.find_element_by_xpath("//XPATH")
    comment.send_keys(comments)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

To send a character sequence to the element instead of visibility_of_element_located() you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategy:

try:
    browser.execute_script("window.scrollBy(0,600)", "")
    WebDriverWait(browser, 60).until(EC.element_to_be_clickable((By.XPATH, path)))
    comment = browser.find_element_by_xpath("//XPATH")
    comment.send_keys(comments)

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
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352