Created
September 13, 2015 20:12
-
-
Save yask123/6d15ce705ca33136c683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dispatch(target, eventType, char) { | |
var evt = document.createEvent("TextEvent"); | |
evt.initTextEvent (eventType, true, true, window, char, 0, "en-US"); | |
target.focus(); | |
target.dispatchEvent(evt); | |
} | |
dispatch(document.querySelector("#compose-input div"), "textInput", "hello!"); | |
function triggerClick() { | |
var event = new MouseEvent('click', { | |
'view': window, | |
'bubbles': true, | |
'cancelable': true | |
}); | |
document.querySelector(".icon.btn-icon.icon-send").dispatchEvent(event) | |
} | |
triggerClick() |
tried kinda everything , can someone tell me the step by step process for mac please.
How to modify this so that I can send same whatsapp message to multiple contacts based on their name or mobile no? Pls help
As per @gokunambiar. Is there a way to trigger a sele/click on an item in the chat list on the left panel?
Hi! How might I integrate this code with WhatsApp API feature?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm surprised anyone can get this to work, for me document/window is not defined in whatsapp web. I cant select the elements .click() on them. Even with Xpath, I can select on elements when a chat window is already open, but I can't get javascript to click on an avatar to open up one of those chats? am I wrong?