goodblues
goodblues

Reputation: 51

Rendering differences between phantomjs and my web browser

I am trying to take a screenshot from a webpage with PhantomJS. I use the following code (which works) :

    var args = phantom.args;
    var Address = args[0];
    var Destination = args[1];
    var page = require('webpage').create();
    page.viewportSize = { width: 1349, height: 653 };
    page.open(Address, function () {
        page.render(Destination);
        phantom.exit();
    });

Unfortunately, the image I get from PhantomJS has some differences with what I see in my browser (chrome and firefox). The text is sometime larger, the button does not have the same behavior, ...

Does anyone could explain why or how to get the exact screenshot of what I see in my browser ? Thanks !

Upvotes: 3

Views: 1265

Answers (1)

Cybermaxs
Cybermaxs

Reputation: 24558

Look at the rasterize.js example and the wiki page here.

Sometimes you need to delay rendering a few seconds.

Upvotes: 1

Related Questions