Yesterday I made this code to send messages by whatsapp. However, I tried many paths to place the message in the messagebox, but nothing seems to be working. Everytime I get the error: Message: unknown error: call function result missing 'value'. I tried all the xpaths (classes) to insert the message, so I think something else is going wrong. When running the code, it opens the web.whatsapp, selects the right person, selects the messagebox, but doesn't place the message in it. Or could it be the version of my driver and chrome which are not corresponding well?
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import datetime
import time
# Replace below path with the absolute path
# to chromedriver in your computer
driver = webdriver.Chrome('insert driver_path')
driver.get("https://web.whatsapp.com/")
WebDriverWait(driver, 10)
name = 'Name Person'
text = 'test from bot'
select_contact = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div[role='option'] span[title='{}']".format(name)))).click()
time.sleep(2)
# select_messagebox = driver.find_element_by_css_selector('.pluggable-input-placeholder')
# select_messagebox = driver.find_element_by_class_name('_3FRCZ copyable-text selectable-text')
select_messagebox = driver.find_element_by_xpath('insert x path')
time.sleep(2)
select_messagebox.send_keys(text)