Home > Blockchain >  How to fix element not interactable using Selenium Python
How to fix element not interactable using Selenium Python

Time:03-11

How to fix element not interactable selenium py

I want to input in address but its showing response like that

Element image:

image

My code:

driver.find_element_by_class_name('input-group').click()
time.sleep(1)
driver.find_element_by_class_name('input- 
group').send_keys('sometext')

Error:

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

CodePudding user response:

I can’t test this but I think you cannot enter something in the div. You have to do get the input element by id. As the Id you enter: input-6199bf2c

CodePudding user response:

To send a character sequence to the element 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, "//label[contains(., 'Address')]//following::div[1]/input[starts-with(@id, 'input') and contains(@class, 'form-control-alternative')]"))).send_keys("PermataIndah")
    
  • 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
    
  • Related