Commit Graph

10 Commits

Author SHA1 Message Date
Andrey Lushnikov
68a24b7336 Implement phantom's detecsniff example with puppeteer API. 2017-05-12 14:23:33 -07:00
Andrey Lushnikov
c3a3bfe1d2 Implement Page.evaluateOnInitilized method
The PhantomJS has a similar callback called onInitialized. This
callback passes control to the automation script when the page
gets initialized.

To precisely implement this functionality atop of puppeteer,
and since puppeteer controller script lives in a separate process to
the page, we need an ability to pause page at the moment of
initialization. For now, we are not able to do this.

However, oftentimes clients want to evaluate certain code in
page at the point of page initialization. This patch implements
this capability with the Page.evaluateOnInitilized method call.

This patch also re-implements phantom's unrandomize.js example
with the puppeteer API. This is serves an illustration purpose
for the page.evaluateOnInitilized callback.
2017-05-12 14:13:40 -07:00
Andrey Lushnikov
073f6409d8 Add colorwheel.js puppeteer example
This patch re-implements PhantomJS colorwheel example with
puppeteer API.
2017-05-12 11:14:32 -07:00
Andrey Lushnikov
7bf3684039 Update examples/screenshot.js to use Page.saveScreenshot 2017-05-12 11:12:32 -07:00
Andrey Lushnikov
52e2633f32 Introduce Page.saveScreenshot
Page.saveScreenshot uses filepath to infer screenshot type (either
PNG of JPG) and saves the screenshot to file system.
2017-05-12 10:50:06 -07:00
Andrey Lushnikov
10d388b9b1 add phantomjs examples under third_party/phantomjs/examples 2017-05-12 10:33:14 -07:00
Andrey Lushnikov
2de672ed1b Introduce Page.injectFile method
With this patch, page has two methods to include javascript:
- Page.addScriptTag(url) which is similar to phantom's includeJs.
- Page.injectFile(filePath) which is similar to phantom's injectJs.
2017-05-12 10:19:01 -07:00
Andrey Lushnikov
e991b0e20a Implement puppeteer's Page.addScript 2017-05-12 10:01:22 -07:00
Andrey Lushnikov
2cda8c18d1 Puppeteer: staging commit. 2017-05-11 00:06:41 -07:00
Eric Bidelman
ebac211411 Initial commit 2017-05-09 15:16:13 -07:00