Skip to content
James M. Greene edited this page May 26, 2013 · 2 revisions

Page background color

PhantomJS does not set the background color of the web page at all, it is left to the page to decide its background color. If the page does not set anything, then it remains transparent.

To force a certain color for the web page background, use the following code:

page.evaluate(function() {
    document.body.bgColor = 'white';
});

Make sure this is executed before caling render() function of the web page.

Clone this wiki locally