1

For study purposes, i'm trying to programatically send a message in the web version of Whatsapp Web (https://web.whatsapp.com) using only pure Javascript.

By using Chrome devtools, i can see the box where the user type the message, which is show on the image below. Actually is not an input ou textarea, is a div. So i'm trying to fill it with my message by using the code below :

document.getElementsByClassName('_3u328 copyable-text selectable-text')[0].innerText = 'This is my message';

Altough i can see the box filled with the message, when i try to send this message, nothing happens. It's like the box was not filled. I think i need to use something related to dispatchEvent method, but i don't know how.

Please help me, thanks

enter image description here

delphirules
  • 6,443
  • 17
  • 59
  • 108
  • you want to send the text by pressing enter or by injected script? – V. Sambor Jan 26 '20 at 12:16
  • Any way, my problem at the moment is not send the text, but filling the DIV content using JS – delphirules Jan 26 '20 at 12:17
  • But you said you already manage to fill the text << Altough i can see the box filled with the message>> oO – V. Sambor Jan 26 '20 at 12:24
  • It fills, but it's like it's not filled. I need something similar to this question, but for a DIV : https://stackoverflow.com/questions/58767291/why-setting-a-value-for-an-input-wont-work-on-whatsapp – delphirules Jan 26 '20 at 12:25
  • Have you figured this out? If you have please post the workaround. – Orlin Oct 12 '22 at 09:06

0 Answers0