0

I'm attempting to inject the following gremlins.js code into my webpage with the command line (node):

javascript:(function(){function callback(){gremlins.createHorde().unleash()} var s=document.createElement("script");s.src="https://rawgithub.com/marmelab/gremlins.js/master/gremlins.min.js";if(s.addEventListener){s.addEventListener("load",callback,false)}else if(s.readyState){s.onreadystatechange=callback}document.body.appendChild(s);})()

but I keep getting the ReferenceError: document is not defined error, and I haven't been able to find anything yet that fixes it. I am relatively new to javascript. Can anyone help me out?

Moritz Schmitz v. Hülst
  • 3,229
  • 4
  • 36
  • 63
  • You want to inject this code from node side to client side? – yue you Feb 06 '18 at 20:36
  • I think so? (I'm relatively new). I'm running a NightWatch test, and I'm trying to use a command to 'Run a JavaScript script in the current browser context.' I don't know if this helps, but it's what I know. – SpadeSeveren Feb 06 '18 at 22:04

0 Answers0