4
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

1 Answer 1

1

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"]')
Sign up to request clarification or add additional context in comments.

1 Comment

I meet a case that when I edit value in the input area, the class is look like this, 1111 is what I enter. <div class="ChatMessageInputView_growWrap__mX_pX" data-replicated-value="1111"><textarea class="ChatMessageInputView_textInput__Aervw" placeholder="Type a message..."></textarea></div> ..... however, I cannot send_keys

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.