I have been trying to replace execCommand() since it is obsolete/deprecated, but nothing seems to works. The below code works fine but I am checking if there is a better way?
This is the JS I used btw;
def insert(value, driver):
script_insert = f'''
const el = document.querySelector('div[title="Type a message"]');
el.focus();
document.execCommand('insertText', false, '{value}');
'''
driver.execute_script(script_insert)
script_send = f'''
const button = document.querySelector('button[data-tab="11"]');
button.click()
'''
driver.execute_script(script_send)