Opening local html file with SlimerJS
I have a script that works in PhantomJS, but I am trying to migrate to SlimerJS. When I try to open a local file, I get an error:
var webPage = require('webpage'); var system = require('system'); var page = webPage.create(); page.viewportSize = { width: 2048, height: 1536 }; console.log('Processing',system.args[1]); page.open( 'simple.html', function start(status) { setTimeout(function(){ page.render(system.args[2], {format: 'png'}); phantom.exit(); },1000); } );
simple.html
is a file located in the same directory as the script. As a result, PNG says "Address not found", "simple.html not found. Please check the name and try again."
I've also tried:
- full path to OS, for example
/User/blah/blah/simple.html
- File URI
file:///Users/blah/blah/simple.html
They give a similar result.
I'd rather not have the script publicly available for various reasons. Can I run a local file using SlimerJS?
+3
source to share
2 answers