I spent a lot of time to narrow down the problem I faced. I am doing my first project on phantomjs and can't execute even simple example Could anybody try on your working version of phantomjs ?
var page = require('webpage').create();
var url = 'http://phantomjs.org/';
page.open(url, function() { console.log("UAHH"); phantom.exit();});
I feel I miss something really simple. I've put handlers on onResourceError, osResourceReceived, onResourceRequested and getting following results.
= onResourceError()
- unable to load url: "http://phantomjs.org/"
- error code: 5, description: Operation canceled
= onResourceReceived()
id: 4, stage: "end", response: {"contentType":null,"headers":[],"id":4,"redirectURL":null,"stage":"end","status":null,"statusText":null,"time":"2016-12-14T00:57:18.222Z","url":"http://phantomjs.org/"}
= onResourceRequested()
request: {
"headers": [
{
"name": "Accept",
"value": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.0.0 Safari/538.1"
}
],
"id": 5,
"method": "GET",
"time": "2016-12-14T00:57:18.222Z",
"url": "http://phantomjs.org/" }
It happens under gentoo. Phantomjs 2.0.0. It seems like it's definitely a problem with selinux under gentoo though I haven't solved it yet. Btw, I've found that zombiejs just works, no problems :) One of my colleagues adviced me to check this library :)