I am trying to open a local HTML-file with PhantomJS (version 1.9.2):
var page = require('webpage').create(), fs = require('fs'),
address = "/Full/Path/To/test.html";
console.log('isFile? ' + fs.isFile(address));
console.log('isReadable? ' + fs.isReadable(address));
page.open(address, function(status){
console.log('status? ' + status);
console.log(page.content)
phantom.exit();
});
First I check if I got the right path and if the file is readable using fs.isFile()
& fs.isReadable()
. Then I check whether phantomjs succeeded in opening the file (with status
). Independent of the actual contents of the file I always get:
isFile? true
isReadable? true
status? fail
<html><head></head><body></body></html>
So the file and the path seem to be okay – but PhantomJS fails to open it! Any suggestions?