ariya / phantomjs

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

Status 'fail' on loading css #11501

Closed Natalie-Dunice closed 8 years ago

Natalie-Dunice commented 11 years ago

I'm using 1.9.1 version of PhantomJS. And also tried to use 1.9.0 version of PhantomJS and a fresh build of latest master. Phantom does not load css and has status 'fail'. I also tried to use local and other servers like apache. For testing I use this code:

var page = require('webpage').create();

var cssUrl = 'http://31.31.201.139:8001/download/any.css';
var otherUrl = 'http://31.31.201.139:8001/download/any.other';

page.open(cssUrl, function (status) {
    console.log('css status', status)
    page.open(otherUrl, function (status) {
        console.log('other status', status)
        phantom.exit();
    });
});

I've launched this on different operation systems and result was the same.

JamesMGreene commented 11 years ago

Can you please explain your use case for trying to open a CSS file as a webpage?

Natalie-Dunice commented 11 years ago

@JamesMGreene

Sure.

I had been trying to do that after I found that some page load results are failed. Then I enabled debugging by showing requests/response headers. Actually when I load the page, phantomjs loads all its dependencies like js and css files. I supposed that the problem in css file loading.

The page I tried to load is https://sports.bwin.com/en/sports/events/4/1899/3261172/betting/zenit-st-petersburg-fc-nordsj%C3%A6lland

Thanks for any help!

vitallium commented 8 years ago

You can't load a CSS file with PhantomJS. This is not supported.