Cannot install phantomJS in Karma
npm install karma-jasmine –save-dev npm install karma-phantomjs-launcher –save-dev Then add the following line to karma.config.js plugins : [‘karma-jasmine’, ‘karma-phantomjs-launcher’]
npm install karma-jasmine –save-dev npm install karma-phantomjs-launcher –save-dev Then add the following line to karma.config.js plugins : [‘karma-jasmine’, ‘karma-phantomjs-launcher’]
PhantomJS 1.9 has introduced a new setting, resourceTimeout, that controls how long a request can take before it gets cancelled. Along with that, there’s a onResourceTimeout event that is triggered if/when a request times out. Here’s a code snippet illustrating all of the above: var page = require(‘webpage’).create(); page.settings.resourceTimeout = 5000; // 5 seconds page.onResourceTimeout … Read more
I had the same problem. Installing the urw-fonts package solved it for me: yum install urw-fonts
According to PhantomJS dev’s comment on GitHub, the full support of ES6 will come with PhantomJS 2.5.
PhantomJS can open local files without any problems. The url have to follow classic Url/Uri rules, especially for a local file. /Full/Path/To/test.html is not valid for PhantomJS. Is it a local file or a web resource? Depending of the path, just try with something like this: file:///C:/Full/Path/To/test.html or if it’s hosted in a web server: … Read more
The documentation says : To run your script, simply enter the __run() command in the Web Inspector Console. __run() is not a no-op but just a wrapper to your script. You need to select Console tab first and then enter __run() in the command window. If you are familiar with Chrome, it’s fairly the same … Read more
Found this post which explains how to set up callbacks to get at the underlying reason for the failure: http://newspaint.wordpress.com/2013/04/25/getting-to-the-bottom-of-why-a-phantomjs-page-load-fails/ Based on the that page, you could print out errors as follows: page.onResourceError = function(resourceError) { console.error(resourceError.url + ‘: ‘ + resourceError.errorString); }; The page goes on to show an example of detailed logging for … Read more
UPDATED, Working! Since PhantomJS 1.9, the existing answer didn’t work. You must use this code: var webPage = require(‘webpage’); var page = webPage.create(); page.onResourceRequested = function(requestData, networkRequest) { var match = requestData.url.match(/wordfamily.js/g); if (match != null) { console.log(‘Request (#’ + requestData.id + ‘): ‘ + JSON.stringify(requestData)); networkRequest.cancel(); // or .abort() } }; If you use … Read more
Run the file with node. If there is a parse error it will report it. If the file is valid, then node will also try to run it, which will fail if your script depends on something not available in your node environment. So you’ll have to ignore any runtime errors. For example, given hello-world.js: … Read more
Install UPX. UPX is an executable packer and unpacker $ brew install upx Unpack the phantomjs executable $ upx -d phantomjs-2.0.0-macosx/bin/phantomjs Run the phantomjs executable $ ./phantomjs-2.0.0-macosx/bin/phantomjs