Commit Graph

3126 Commits

Author SHA1 Message Date
Andrey Lushnikov
91e54378a3 Implement printing to PDF
This patch implements:
- puppeteer's Page.printToPDF method. The method's defaults
  are similar to phantom's defaults for the paperSize property.
- phantom's render into pdf file.
2017-05-14 22:00:39 -07:00
Andrey Lushnikov
72ce46c4f6 Roll chromium to r471584 2017-05-14 20:07:27 -07:00
Andrey Lushnikov
e0a9cd5c08 Phantom's WebPage.injectJs should return boolean
This patch fixes Phantom Shim WebPage.injectJs to
return boolean.
2017-05-13 13:45:33 -07:00
Andrey Lushnikov
bdf895bed6 Support Page.{Alert,Confirm,Prompt,BeforeUnload} events
This patch adds Page events to fire when javascript dialogs
get opened.
2017-05-13 13:44:24 -07:00
Andrey Lushnikov
de9605a8b0 Implement PhantomJS's fs.makeTree method
This patch implements missing PhantomJS's fs.makeTree method.
2017-05-13 12:42:56 -07:00
Andrey Lushnikov
939038bb08 Convert event names to small caps
This patch takes inspiration from DOM events and makes all the
events small-caps.
2017-05-13 12:04:30 -07:00
Andrey Lushnikov
cf900cf717 Add missing test assets
This patch adds missing assets/empty.html which is needed for one of
the puppeteer tests.
2017-05-13 11:18:52 -07:00
Andrey Lushnikov
5ea703f2f4 Re-implement phantom's pagecallback.js example with puppeteer
This patch adds examples/pagecallback.js file which illustrates
phantom's pagecallback example re-implemented with puppeteer API.
2017-05-13 11:17:45 -07:00
Andrey Lushnikov
15b36b1cf0 Drop unneeded Page Event's prefixes.
This patch drops 'Page.Event.' prefix in every puppeteer's page
event. This makes it convenient to subscribe to events by their
string value.
2017-05-13 11:12:06 -07:00
Andrey Lushnikov
8a8076c15b Rename Page.Events.ConsoleMessageAdded -> Page.Events.ConsoleMessage
This patch:
- renames ConsoleMessageAdded into ConsoleMessage for the sake of
  clarity
- adds a test to cover basic functionality
2017-05-13 11:05:54 -07:00
Joel Einbinder
2b0d0e6551 Defer evaluation onInitalized 2017-05-12 18:01:17 -07:00
Andrey Lushnikov
e8af69e5bb Make in-page callback survive navigations
This patch makes in-page callbacks survive navigations via
running in-page harness code on page load.
2017-05-12 17:55:29 -07:00
Andrey Lushnikov
ab6a96a991 Fix License header of certain examples
Certain examples rely extensively on the originating PhantomJS
examples.

This patch fixes license headers of these examples to mention
PhantomJS authors.
2017-05-12 16:48:02 -07:00
Andrey Lushnikov
6fc54665e4 Add minimal test framework
This patch adds some minimal tests for puppeteer's Page using
Jasmine.
2017-05-12 16:38:07 -07:00
Andrey Lushnikov
62e68159f4 Re-implement phantom's examples/features.js in puppeteer api. 2017-05-12 14:57:55 -07:00
Andrey Lushnikov
58ad5dd823 fix implementation of Page.injectFile method 2017-05-12 14:45:47 -07:00
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