Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

324
Visualizações
How to fill message box on Whatsapp Web?

I'm trying to send a message on Whatsapp Web (https://web.whatsapp.com/) only using Javascript, for study purposes.

Here is the DIV that has the message box :

enter image description here

<div class="fd365im1 to2l77zo bbv8nyr4 mwp4sxku gfz4du6o ag5g9lrv" contenteditable="true" role="textbox" spellcheck="true" title="Type a message" data-tab="10" data-lexical-editor="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;"><p class="selectable-text copyable-text"><br></p></div>

And here is my code :

document.getElementsByClassName('fd365im1 to2l77zo bbv8nyr4 mwp4sxku gfz4du6o ag5g9lrv')[0].innerText = 'My message content';

The code runs without errors, but the message field is not filled, nothing happens on the interface. This code used to run before, but not anymore.

What am i missing ? You can try your self accessing the whatsapp web and using Chrome devtools.

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

you can use

function send_text(text) {
const dataTransfer = new DataTransfer();
dataTransfer.setData('text', text);
const event = new ClipboardEvent('paste', {
      clipboardData: dataTransfer,
      bubbles: true
    });
let el = document.querySelector('#main .copyable-area [contenteditable="true"][role="textbox"]')
el.dispatchEvent(event)
}
send_text("yourText")
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda