Reputation: 41
from selenium import webdriver
import time
import os, time
driver = webdriver.Chrome(executable_path=r"C:\Users\carlo\OneDrive\Escritorio\chromedriver.exe")
driver.get("https://web.whatsapp.com/")
time.sleep(10)
name = 'me'
user = driver.find_elements_by_xpath('//span[@title = "{}"]'.format(name))[0]
user.click()
msj_box = driver.find_element_by_xpath('//div[@class="_2FbwG"]')
msj_box.send_keys('la caja')
msj_box = driver.find_element_by_xpath('//button[@class="_1U1xa"]')
msj_box.click()
This got probleman when is running the following line
msj_box.send_keys('la caja')
And the output is this
File "c:/Users/carlo/OneDrive/Escritorio/wp3.py", line 23, in <module>
msj_box.send_keys('la caja')
File "C:\MIS programas\python\lib\site-packages\selenium\webdriver\remote\webelement.py", line 477, in send_keys
self._execute(Command.SEND_KEYS_TO_ELEMENT,
File "C:\MIS programas\python\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\MIS programas\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\MIS programas\python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=83.0.4103.116)
Please help
Upvotes: 4
Views: 12501
Reputation: 41
It seems the reason you are getting the error is because you are using the method SendKeys with a Div element rather than to an input or text area.
msj_box = driver.find_element_by_xpath('//div[@class="_2FbwG"]')
Upvotes: 1