0

I want to render a webpage from a string. I've looked at the docs of phantomjs and they suggested the following:

var webPage = require('webpage');
var page = webPage.create();
var expectedContent = '<html><body><div>Test div</div></body></html>';
var expectedLocation = 'http://www.phantomjs.org/';
page.setContent(expectedContent, expectedLocation);

It's not quite working. Why? (I use the latest version).

hibye
  • 57
  • 6

1 Answers1

1

I suggest you render a normal page (about:blank works) and then do webPage.content='<html><body><div>Test div</div></body></html>';

then render your page.

hope that helps.

JasonS
  • 7,443
  • 5
  • 41
  • 61