-
-
Save srph/e53d2db462f05c669f43 to your computer and use it in GitHub Desktop.
Send a Facebook Chat to Friends using Browser Console
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
// target the every anchor element (friend in friendlist) | |
var elem = document.querySelectorAll("a._55ln"); | |
for(var i=0 in elem) { | |
// trigger the anchor element | |
elem[i].click(); | |
//target the text area | |
var textArea = document.getElementsByClassName("uiTextareaAutogrow _552m"); | |
var chatBox = textArea[0]; | |
// message value here | |
chatBox.value = "Hello, This is a test chat from console please dont reply"; | |
// create an event | |
var e = new Event("keydown"); | |
// keycode for Enter/Return key | |
e.keyCode = 13; | |
// it will trigger the Enter/Return key | |
chatBox.dispatchEvent(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment