Force React to fire event through injected JavaScript
"Solution" After two days of research I have to admit that this is obviously not possible on the way I tried it for security reasons. If you ever get into the same situation like me you shouldn´t waste time on trying to fix this, rather than just looking for a good workaround. I will update mine for the WebWhatsapp-bot here if i figured it out.
use the following library
1.https://github.com/dwachss/bililiteRange/blob/master/bililiteRange.js 2.https://github.com/dwachss/bililiteRange/blob/master/jquery.sendkeys.js
load (paste in console) this js script in chrome console in following sequence
1.load jquery.js
2.load bililiteRange.js
3.load jquery.sendkeys.js
Now you can send the text to the Whatsapp input box like this example:
var input_op=jQuery("#main div.pluggable-input-body.copyable-text.selectable-text");
input_op.sendkeys("hello");
for stimulating the Click event on send button do this :
function triggerMouseEvent(node, eventType) {
var clickEvent = document.createEvent('MouseEvents');
clickEvent.initEvent(eventType, true, true);
node.dispatchEvent(clickEvent);
}
var d = document.querySelector("#main span[data-icon="send"]");
triggerMouseEvent(d, "click"); //stimulate mouse event in chrome
Done