Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

315
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!