AaravM4
AaravM4

Reputation: 410

Selenium Python: 'ElementNotInteractableException'

I am trying to send_keys to input with id model-account-name-input from this link. Here is my code:

driver.find_element_by_id('model-account-name-input').click() #Make it reachable by Keyboard
driver.find_element_by_id('model-account-name-input').send_keys('Test')

With this code I get the following error: ElementNotInteractableException: Message: Element <input id="modal-account-name-input" class="menu-option player-name-input" type="text"> could not be scrolled into view.

Here is an Image of the input I want to send_keys to. enter image description here

Upvotes: 1

Views: 74

Answers (1)

KunduK
KunduK

Reputation: 33384

To Enter Text in text box induce WebDriverWait and wait for element_to_be_clickable() and following ID.

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver=webdriver.Chrome()
driver.get("https://surviv.io/")
WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.ID,"player-name-input-solo"))).send_keys("Test")

Browser snapshot.

enter image description here

Upvotes: 1

Related Questions