I'm having trouble getting a screen capture from my application while using the phantomjs.rb gem. I'm currently just trying local url's. If I get those working I'll use url_for's later.
In my controller:
Phantomjs.run('./public/javascripts/testScreenCapture.js', 'http://localhost:3000')
And my testScreenCapture.js:
var page = require('webpage').create();
var args = require('system').args;
var url = args[1];
page.open(url, function () {
window.setTimeout(function () {
page.render('./public/appPage.png');
phantom.exit();
}, 3000);
});
Passing "http://www.google.com" as the url argument works fine, it's just when I pass anything from my local server is when the rails server hangs and I'm assuming the phantomjs script as well since I'm not getting an screenshot in my public folder.
What's even more odd is running this from command line:
phantomjs public/javascripts/testScreenCapture.js http://localhost:3000
This works great! So I'm assuming it's something wrong with my controller conflicting with the server. Any ideas?