Saturday, 15 March 2014

phantomjs - Opening local html file with SlimerJS -



phantomjs - Opening local html file with SlimerJS -

i have script works in phantomjs i'm trying switch slimerjs. maintain getting error when trying open local file:

class="lang-slimerjs prettyprint-override">var webpage = require('webpage'); var scheme = 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 file located in same directory script. resulting png says "address not found", "simple.html not found. please check name , seek again."

i've tried:

full os path, eg /user/blah/blah/simple.html file uri file:///users/blah/blah/simple.html

these yield similar result.

i'd rather not have script publicly available variety of reasons. possible launch local file slimerjs?

i don't think possible. reading docs specifies url.

i got around running http server

python -m simplehttpserver

then accessing through localhost.

page.open('http://localhost:8000/simple.html',...)

phantomjs slimerjs

No comments:

Post a Comment