PhantomJS create page from string

后端 未结 5 1402
忘掉有多难
忘掉有多难 2020-12-08 04:21

Is it possible to create a page from a string?

example:

html = \'blah blah blah\'

page.open(html,         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 04:50

    It's very simple, take a look at the colorwheel.js example.

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

    Hello world

    ';

    That's all! Then you can manipulate the page, e.g. render it as an image.

提交回复
热议问题