Created
July 6, 2015 12:00
-
-
Save kedorlaomer/531cfeaf11d070f6ea1a to your computer and use it in GitHub Desktop.
How sendEvent in slimerjs doesn't work
This file contains hidden or 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
var page = require('webpage').create(); | |
page.open("http://slimerjs.org", function(status) { | |
if (status == 'success') { | |
page.render('out.jpg', {quality: '100'}); | |
} | |
}) | |
window.setTimeout(function() { | |
var pair = page.evaluate(function(){ | |
var button = document.getElementById("download"); | |
var x = button.getBoundingClientRect().x; | |
var y = button.getBoundingClientRect().y; | |
return [x, y]; | |
}); | |
var x = pair[0]; var y = pair[1]; | |
page.sendEvent('click', x+2, y+2, 'left'); | |
// second screenshot (nothing has changed!) | |
window.setTimeout(function() { | |
page.render('out2.jpg', {quality: '100'}); | |
}, 5000); | |
} , 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment