ariya / phantomjs

Scriptable Headless Browser
http://phantomjs.org
BSD 3-Clause "New" or "Revised" License
29.45k stars 5.76k forks source link

PhantomJS status 'fail' for CSS file #13206

Closed yogeshugam closed 8 years ago

yogeshugam commented 9 years ago

I am getting Status=fail when requesting this CSS file

PhantomJS version = 2.0.0 Link : http://www.nfm.com/Content/MainMasterCss_C4BA203F2F5805AA4E787B1466B7F298.css

Even debugging not helping much.

console.log('Loading a web page');
var page = require('webpage').create();
var url = 'http://www.nfm.com/Content/MainMasterCss_C4BA203F2F5805AA4E787B1466B7F298.css';
page.open(url, function (status) {
   console.log(status);
   page.render('sample.jpg');
   phantom.exit();
});
vitallium commented 9 years ago

PhantomJS doesn't support any content except HTML (XML). You can't open non-HTML page directly.

Duplicate. Please see #11501 #10695

yogeshugam commented 9 years ago

I am trying to load an HTML and generate JPG from it.

This CSS file is not loading in PhantomJS and thus i am getting distorted JPG.

But same html source loads correct in browser.

vitallium commented 9 years ago

@yogeshugam you can get the reason why your CSS file didn't load by using onResourceError callback

yogeshugam commented 9 years ago

@Vitallium no resourceError.id is generated for this CSS request