0

I'm using Selenium with Python to input an address into a textbox within the Glovo page for Madrid. The code I wrote can be seen below, and the error I get is also copied after the code.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
  
url = 'https://glovoapp.com/es/es/madrid/'

# open browser
driver = webdriver.Chrome()

# load page
driver.get(url)

# find field 
item = driver.find_element_by_class_name('address-input__container')

# select textbox and input text
time.sleep(2)
item.click()

WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.CLASS_NAME, "el-input__inner"))
    )
item = driver.find_element_by_class_name('el-input__inner')
time.sleep(2)

item.send_keys('Calle')

The error I get is shown below.

    Traceback (most recent call last):

    item.send_keys('Calle')

      File "C:\Users\Usuario\anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 477, in send_keys
    self._execute(Command.SEND_KEYS_TO_ELEMENT,

      File "C:\Users\Usuario\anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
    return self._parent.execute(command, params)

      File "C:\Users\Usuario\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)

      File "C:\Users\Usuario\anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)

`ElementNotInteractableException: element not interactable`
  (Session info: chrome=91.0.4472.124)

2 Answers 2

2

Locator you are using is returning 2 different elements. See if this works

item = driver.find_element_by_xpath("//input[@class='el-input__inner' and @data-test-id='address-input-autocomplete']")
item.send_keys("Calle")
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the reply! It worked now. Just so I understand how you solved it... how did you notice that the locator was returning 2 different elements?
0

Using various xpath for the element address-input__containerand trying to click it is not working while automation and throws ElementNotInteractableException: Message: element not interactable You can refer this question. Applying the same and it works.

from selenium.webdriver.common.action_chains import ActionChains

driver.get("https://glovoapp.com/es/es/madrid/")
box = driver.find_element_by_class_name('address-input__container')
time.sleep(2)
ActionChains(driver).move_to_element(box).click(box).perform()
driver.find_element_by_xpath("//input[@data-test-id='address-input-autocomplete']").send_keys("SampleText")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.