Commit Graph

1092 Commits

Author SHA1 Message Date
Andrey Lushnikov
da85b4466e [docs] Add CentOS troubleshooting notes (#579) 2017-08-28 10:21:54 -07:00
Andrey Lushnikov
ea4f8d78fc Mark version 0.10.1 2017-08-25 19:37:53 -07:00
Andrey Lushnikov
be4da580d4 Bump tip-of-tree version to 0.10.1-alpha (#534)
This patch:
- bumps tip-of-tree version to 0.10.1-alpha
- updates api.md to refer to released API and fix a nit in README.md
2017-08-24 22:47:57 -07:00
Andrey Lushnikov
751164c69f Mark version 0.10.0 2017-08-24 18:11:43 -07:00
JoelEinbinder
0791774faa Cookies (#314)
Introduce cookies API. 

Fixes #53.
2017-08-24 12:21:46 -07:00
Andrey Lushnikov
b8c3686e6d [doc] elaborate on url parameter in page.goto. (#504) 2017-08-23 15:34:57 -07:00
Vse Mozhet Byt
4471969524 fix a typo in the api.md (#505) 2017-08-23 14:29:47 -07:00
JoelEinbinder
a1414de42f Implement page.setJavaScriptEnabled method
Fixes #462.
2017-08-23 14:08:56 -07:00
Andrey Lushnikov
63e2b36d29 [doc] Add reference to released API 2017-08-23 13:44:44 -07:00
Eric Bidelman
a330c8eeba Bump version to 0.9.1-alpha
This patch bumps version to 0.9.1-alpha.
This should emphasize that the documentation is related to the tip-of-tree
version of puppeteer, not to the latest release.
2017-08-23 13:39:35 -07:00
Andrey Lushnikov
151d512ae2 Implement page.$$ method (#463)
This patch implements page.$$ which runs document.querySelectorAll
in page and returns results as an array of ElementHandle instances.

Fixes #384.
2017-08-22 22:56:55 -07:00
Andrey Lushnikov
271fd09379 Launcher: add timeout to chrome launching (#434)
This patch:
- adds a 'timeout' launcher option that constrains the time for chromium to launch.
- adds a 'handleSIGINT' launcher option that is `true` by default and that closes chrome instance

Fixes #363.
2017-08-21 15:43:36 -07:00
John Resig
598f439a32 Add Page.content() method. Fixes #406. (#419) 2017-08-21 09:02:30 -07:00
Andrey Lushnikov
6fcf3d9148 Fix grammar in troubleshooting.md 2017-08-20 19:56:04 -07:00
R.Frega
16e1499dbe doc: fix typo (#431) 2017-08-20 19:54:05 -07:00
Andrey Lushnikov
fcb8ab9cd7 Add troubleshooting.md (#428)
This patch adds troubleshooting.md and starts referring to it if puppeteer 
fails to launch chromium.
2017-08-20 19:46:13 -07:00
Vse Mozhet Byt
281db8fecc doc: change ambiguous phrase in api.md (#410) 2017-08-20 16:44:52 -07:00
Andrey Lushnikov
292c7a237f doc: remove mentions of removed Boxy mixin (#425)
Fixes #399.
2017-08-20 16:03:30 -07:00
Andrey Lushnikov
6a35c97c7f doc: fix descriptions of certain page methods (#424)
This patch fixes descriptions of:
- page.click()
- page.focus()
- page.hover()

Fixes #397
2017-08-20 16:03:14 -07:00
Vse Mozhet Byt
6581416897 doc: fix some nits in code examples from api.md (#407)
* Replace let with const in examples when appropriate.
* Unify spacing.
* Fix possible copy-paste artifacts.
* Eliminate one unhandled promise rejection ('Target closed').
2017-08-20 14:50:24 -07:00
Vse Mozhet Byt
9ede3144c5 doc: fix some links in api.md (#400) 2017-08-20 14:32:53 -07:00
Andrey Lushnikov
ab125f6a69 doc: Fix return type in response.text() 2017-08-20 14:32:14 -07:00
Vse Mozhet Byt
970e9c4b35 doc: fix copy-paste artefacts (#394) 2017-08-19 10:04:02 -07:00
Vse Mozhet Byt
f8515013ab doc: remove a link to a deleted example (#392)
Refs: https://github.com/GoogleChrome/puppeteer/pull/221
2017-08-19 09:28:58 -07:00
Andrey Lushnikov
6cc274135c Introduce page.emulateMedia method (#383)
Emulating `screen` media would force `page.pdf()` to print with `screen`
media.

Fixes #312
2017-08-18 16:49:02 -07:00
Brikou CARRE
8f43befcc9 Make prettier JS snippets (#377)
* Make prettier JS snippets

* Conform to CS (about curly brace)

* Apply feedback
2017-08-18 16:46:10 -07:00
Pavel Feldman
127f3966d7 Allow capturing transparent screenshots (#354)
This patch adds `omitBackground` option to the `page.screenshot` method.

Fixes #344
2017-08-17 21:11:39 -07:00
JoelEinbinder
b9c7c367ef Add Serializable type into the docs (#318) 2017-08-17 20:24:11 -07:00
JoelEinbinder
5f0afd5547 Move uploadFiles onto ElementHandle (#348)
This patch:
- removes the `page.uploadFile` method
- adds `elementHandle.uploadFile` method.

Motivation: `elementHandle.uploadFile` is rarely used, so it doesn't worth it
to keep it on page.
2017-08-17 14:53:37 -07:00
Simone Sanfratello
2655f20fd3 docs: fix link to ElementHandle (#345) 2017-08-17 09:26:10 -07:00
Satoshi Takeda
e7356bf611 docs: fix typo in event: 'load' section (#325)
fix `JavaScriot` to `JavaScript`
2017-08-16 23:27:19 -07:00
Chandan Rai
e5876c7b4e corrected minor typos (#322) 2017-08-16 21:57:23 -07:00
edgar c
3cc5ba4a6f update code example: setRequestInterceptionEnabled (#294) 2017-08-16 11:19:13 -07:00
Jonathan Garbee
da53218107 Fix doc on pdf method. Minor addition to PDF path option docs. (#292) 2017-08-16 11:11:40 -07:00
Paul Irish
92e64e2354 docs: recommendation of canary if Chrome is preferred (#293) 2017-08-16 11:09:18 -07:00
Andrey Lushnikov
0a190ebec9 Rename 'remoteDebuggingURL' into 'browserWSEndpoint' (#272) 2017-08-16 01:10:55 -07:00
Andrey Lushnikov
44c15220f9 Rename ElementHandle.release into ElementHandle.dispose (#284)
The ElementHandle.release feels related to ElementHandle.click.
The dispose is a more clear name.
2017-08-16 00:49:20 -07:00
JoelEinbinder
3c2aaaaeb0 Readme fixup part 1 (#278) 2017-08-15 23:04:16 -07:00
Andrey Lushnikov
1e5d9fd8c0 Proofreading documentation (#274)
This patch fixes documentation in a few places.
2017-08-15 17:33:03 -07:00
Andrey Lushnikov
af89e893e7 Implement basic element handles (#248)
This patch implements basic element handles which a backed with remote objects.

Fixes #111
2017-08-15 14:54:02 -07:00
Andrey Lushnikov
a424f5613a Introduce Puppeteer.connect method (#264)
This patch:
- refactors Connection to use a single remote debugging URL instead of a
  pair of port and browserTargetId
- introduces Puppeteer.connect() method to attach to already running
  browser instance.

Fixes #238.
2017-08-15 14:29:42 -07:00
Andrey Lushnikov
24764df4c4 Emit 'error' event when page crashes (#266)
This patch starts emitting 'error' event when page crashes.
'error' events have special treatment in node, so page crashes
become observable for users.

Fixes #262.
2017-08-15 11:13:05 -07:00
JoelEinbinder
59256ee5ba Capitalize Chromium and Puppeteer (#263) 2017-08-15 00:14:12 -07:00
Andrey Lushnikov
fd325cd48c Add note about executablePath option to puppeteer.launch (#260) 2017-08-14 23:57:12 -07:00
Andrey Lushnikov
13e8580a34 Use puppeteer.launch instead of browser constructor (#255)
This patch:
- split browser launching logic from Browser into `lib/Launcher.js`
- introduce `puppeteer` namespace which currently has a single `launch`
  method to start a browser

With this patch, the browser is no longer created with the `new
Browser(..)` command. Instead, it should be "launched" via the
`puppeteer.launch` method:

```js
const puppeteer = require('puppeteer');
puppeteer.launch().then(async browser => {
  ...
});
```

With this approach browser instance lifetime matches the lifetime of
actual browser process. This helps us:
- remove proxy streams, e.g. browser.stderr and browser.stdout
- cleanup browser class and make it possible to connect to remote
  browser
- introduce events on the browser instance, e.g. 'page' event. In case
  of lazy-launching browser, we should've launch browser when an event
  listener is added, which is unneded comlpexity.
2017-08-14 18:08:06 -07:00
Andrey Lushnikov
13e0965407 Move emulation documentation under page.emulate method. (#253) 2017-08-13 00:47:01 -07:00
Andrey Lushnikov
4551afc6dc Introduce new interception API (#242)
This patch introduces new interception API, via killing InterceptedRequest and giving the `abort` and `continue` methods to the Request object.
2017-08-11 17:24:31 -07:00
Andrey Lushnikov
dbac6788ae Plumb default prompt value to the dialog (#243)
This patch:
- plumbs default prompt value to the dialog
- enables one more phantom test
2017-08-11 12:17:43 -07:00
Andrey Lushnikov
6347a049ba Rename Page.setInPageCallback into Page.addBinding (#236)
This seems to be a much better name which is actually used for a similar
purposes in chromium/v8.
2017-08-10 21:44:49 -07:00
Pavel Feldman
3a7741a172 Introduce page.emulate convenience wrapper (#231)
This patch:
- introduces Page.emulate convenience wrapper
- adds a screenshot-fullPage.js example
2017-08-10 18:42:30 -07:00
Eric Bidelman
8ccd10bfa2 Docs: add default networkIdleTimeout value (#234) 2017-08-10 14:49:34 -07:00
Andrey Lushnikov
e1d8a3781e Rename Page.navigate into Page.goto (#232)
Fixes #228.
2017-08-10 00:02:10 -07:00
Andrey Lushnikov
34b0095c10 Make interception work with redirects (#218)
This patch:
- changes interception API so that it better aligns with what we'd like to see
  in #121
- fixes the issue with redirect interception

Fixes #217.
2017-08-07 17:48:52 -07:00
Andrey Lushnikov
4f5cad921e [doc] Remove mention of broken javascript dialogs from api.md (#210) 2017-08-04 01:12:18 -07:00
Andrey Lushnikov
31224392bb Kill page.$ and page.$$ functions (#197)
page.$ and page.$$ conflicts with our ideas about element handles.

This patch removes functions in favor of future implementation.

References #111
2017-08-03 13:35:31 -07:00
JoelEinbinder
984e011cf0 Move path option into tracing.start (#192)
This consolidates all the tracing options in the tracing.start()
2017-08-02 15:41:05 -07:00
JoelEinbinder
bd72e40e73 Introduce page.tracing (#181)
This patch introduces page.tracing, which allows to start and stop
trace recording for a page. The trace could be then saved to file.
2017-08-02 10:45:11 -07:00
Andrey Lushnikov
a43c315214 Implement browser 'ignoreHTTPSErrors' option. (#177)
This patch implements Browser 'ignoreHTTPSErrors' option.

Fixes #84.
2017-08-01 15:17:57 -07:00
Andrey Lushnikov
512a052dfc [doc] fix typo in api documentation 2017-08-01 00:05:00 -07:00
Andrey Lushnikov
337315c5fe [doclint] remove preprocessor's gen:copy and gen:paste commands
These commands proved to be over-complicating the documentation source.
We should keep documentation source as simple to edit as possible to
make it friendly to contributions.

This patch keeps the gen:version command as it is non-invasive.
2017-07-31 21:21:45 -07:00
JoelEinbinder
2acfec0989 Slow mode (#173)
This patch introduces a `slowMo` browser option which
slows down puppeteer operations. Comes handy for debugging
scripts.
2017-07-31 18:47:56 -07:00
JoelEinbinder
fc70ab8f21 Add delay option to input methods (#171)
Add delay option to input methods for the keyboard and mouse.

Closes #156
2017-07-31 18:18:15 -07:00
JoelEinbinder
bfc40b2ee6 Specify repeat property on repeated keypresses (#172)
This patch implements 'autoRepeat' functionality for `keyboard.down`.
With this patch, the subsequent calls to `keyboard.down` would generate
an event with 'autoRepeat` flag set to true.

Closes #157
2017-07-31 12:05:46 -07:00
Andrey Lushnikov
08799dd839 [doc] Bring back examples to page shortcut methods
The motivation behind the patch:
- examples are probably the most valuable thing in the doc
- currently, one would need to navigate to `page.evaluate` and then
  click to the `frame.evaluate` to see the example.
- with this patch, all the descriptions for the shortcut methods are
  copied as well. So there's an example for `page.evaluate` right
  away.

Drive-by: fix links for `page.$` and `page.$$`
2017-07-31 04:38:47 -07:00
Andrey Lushnikov
4ee8eb8afc [doclint] introduce preprocessor's gen:copy and gen:paste tasks
The two tasks allow to copy text from one part of document to another.
This comes handy in organizing the documentation for our shortcut
methods, which should be exactly the same as the original methods.

The tasks work like this:
- the gen:copy(id) task saves a part of document under the name 'ID'.
- the gen:paste(id) task pastes text saved with id 'ID'

This patch also fixes a bunch of links in documentation, as well as
migrating `api.md` to use the two tasks.
2017-07-31 04:14:41 -07:00
Andrey Lushnikov
3ada7e1adb [doclint] Implement simple markdown preprocessor
This patch implements simple markdown preprocessor. The goal
is to generate certain parts of markdown, such as:
- puppeteer version
- chromium revision
- table-of-contents
- copy/paste parts of documentation (for shortcut methods)
2017-07-31 02:06:27 -07:00
Eric Bidelman
23d4950498 Docs: minor fixes (#167) 2017-07-29 18:08:35 -07:00
Andrey Lushnikov
bd767002bb Fix navigation to about:blank
This patch fixes navigation to about:blank url.
2017-07-28 16:44:51 -07:00
Andrey Lushnikov
245391cb54 [doc] add missing quote in api.md example 2017-07-28 01:25:33 -07:00
Andrey Lushnikov
d26e2399f2 Resolve paths against CWD in page.uploadFile() method
This patch:
- teaches page.uploadFile() to resolve given file paths against
  current working directory. This aligns paths handling with all the
  other methods
- moves page.uploadFile() under Frame
- changes test to use relative path for file upload
2017-07-28 00:06:57 -07:00
Andrey Lushnikov
0452644b83 [doc] Clarify that path is resolved against current working directory
Fixes #150.
2017-07-27 23:34:32 -07:00
Andrey Lushnikov
ba37a4f82d Get rid of Body class
The Body class was inlined in the Request and Response classes.
This patch:
- removes the Body class
- adds Request.postData public property
- adds Response.buffer(), Response.text() and Response.json() methods

Fixes #106.
2017-07-27 23:11:24 -07:00
Andrey Lushnikov
bd898b7f56 Implement function as a part of a page.waitFor shortcut
This patch adds a function as a possible argument to
page.waitFor shortcut.

Fixes #91.
2017-07-27 17:09:28 -07:00
Andrey Lushnikov
ff5ed1c738 Implement page.waitForFunction method
The page.waitForFunction method allows to wait for a general predicate.
The predicate will be continiously polled for in page, until
it either returns true or the timeout happens.

The polling parameter could be one of the following:
- 'raf' - to poll on every animation frame
- 'mutation' - to poll on every dom mutation
- <number> - to poll every X milliseconds

References #91
2017-07-27 16:45:14 -07:00
Andrey Lushnikov
c26d2c8271 Remove redundant methods from Body class
This patch:
- removes Body.arrayBuffer. This method is redundant since there's
  already a Body.buffer() method
- removes Body.bodyUsed getter.

References #106
2017-07-27 14:43:14 -07:00
JoelEinbinder
847504c53e [doc] link to mdn selector documentation (#155)
closes #149
2017-07-27 13:11:59 -07:00
Andrey Lushnikov
e39d8602b0 Rename page.setHTTPHeaders into page.setExtraHTTPHeaders
This patch:
- renames page.setHTTPHeaders into page.setExtraHTTPHeaders
- starts using Map instead of Object to align with other headers
  arguments

Fixes #112.
2017-07-27 12:51:18 -07:00
JoelEinbinder
bbde8fd1c2 page.evaluate takes a string in addition to function (#135)
This patch improves on page.evaluate to accept a string.
The string can have a trailing '//# sourceURL=' comment which would
name the evaluation to make stacks beautiful.

In order to make sourceURL comments possible, this patch:
- removes wrapping of the client function into `Promise.resolve()`
- stops passing `awaitPromise` parameter to `Runtime.evaluate`
- starts to await promise via the `Runtime.awaitPromise` if the return type of the evaluation
  is promise

closes #118
2017-07-27 12:23:41 -07:00
JoelEinbinder
8870aaee17 Disable and enable some tests based on whether chrome is headless (#154)
This patch:
- Runs dialog test in headful mode only
- Runs pdf test in headless mode only
- Improves on documentation to outline these shortcomings
2017-07-27 11:44:18 -07:00
JoelEinbinder
70f77c1981 add tests for Frame class
This patch:
- improves documentation of frame.name()
- adds a test for frame.name()
- adds a test for frame.parent()

References #50.
2017-07-27 11:36:03 -07:00
Andrey Lushnikov
480547955c Drop Headers class in favor of a Map object
This patch removes Header class and substitutes it with a simple
Map object.

The map is chosen over the vanilla object since it has explicit
order of headers which we'd like to preserve.

References #106.
2017-07-27 09:35:44 -07:00
Will Chen
7a482c5697 docs: fix broken links in API (#144)
This patch fixes links in api.md.
2017-07-26 15:06:23 -07:00
JoelEinbinder
81d4b8f4f8 Document all options objects wherever they are used (#139)
This patch adds missing documentation for all the shortcut methods, such as
`page.evaluate` or `page.waitForSelector`.

closes #114
2017-07-25 21:01:05 -07:00
JoelEinbinder
64968862db Implement mouse.click(x,y) (#131)
Closes #107
2017-07-25 16:05:23 -07:00
Pavel Feldman
eca0d7fe53 Simplify keyboard modifiers handling (#129) 2017-07-25 14:35:03 -07:00
JoelEinbinder
4f5f1f6d77 Move missing methods from page onto frame. (#125)
Closes #113
2017-07-25 11:37:46 -07:00
Andrey Lushnikov
b564029589 Improve documentation for the page.waitFor method.
Fixes #109.
2017-07-25 08:46:11 -07:00
JoelEinbinder
877f06aacb Remove userAgent getter (#126)
If needed, the user agent could be fetched via querying
`navigator.userAgent` in page.

Closes #110
2017-07-25 02:01:10 -07:00
JoelEinbinder
615381c70e Remove browser.closePage. (#124)
Remove browser.closePage. Closes #116
2017-07-25 00:44:13 -07:00
Andrey Lushnikov
d4c5aee5a8 Rename page.evaluateOnInitialized into page.evaluateOnNewDocument
This patch renames page.evaluateOnInitialized into
page.evaluateOnNewDocument to better align with the protocol and with
what the method is actually doing.

Fixes #119.
2017-07-25 00:17:56 -07:00
Andrey Lushnikov
5acd711b20 Remove InterceptedRequest.isHandled() method
This patch removes the InterceptedRequest.isHandled method. There's
always a single request interceptor who owns all the intercepted
requests and who know if they were handled.

References #115.
2017-07-24 23:37:28 -07:00
Andrey Lushnikov
efa33c37b3 Remove page.httpHeaders() getter
Remove the page.httpHeaders() method since it always returns the last
value of page.setHTTPHeaders().

References #115.
2017-07-24 23:35:10 -07:00
Andrey Lushnikov
236acec228 Remove Frame.isMainFrame()
This patch removes redundant frame.isMainFrame() method. The suggested
way to check for main frame is:

```js
frame === page.mainFrame()
```

Fixes #120.
2017-07-24 21:25:54 -07:00
Andrey Lushnikov
5757bc18f2 Rename 'maxTime' option of Page.navigate into 'timeout'
The motivation behind this rename is to name all the 'timeout' options
across methods similarly.

References #39.
2017-07-22 16:32:57 -07:00
JoelEinbinder
98ee35655f Mouse (#101)
This patch:
- adds Mouse class which holds mouse state and implements mouse primitives,
such as moving, button down and button up.
- implements high-level mouse api, such as `page.click` and `page.hover`.

References #40, References #89
2017-07-21 20:29:31 -07:00
JoelEinbinder
eb2cb67b0e Remove keyboard.type and keyboard.press (#98)
This patch removes keyboard.type and keyboard.press methods. The motivation
behind this is to keep only low-level API in the `keyboard` namespace.
2017-07-21 20:00:09 -07:00
Andrey Lushnikov
dc032b42b9 Introduce polymorphic page.waitFor method
This patch:
- introduces page.waitForSelector to wait for the selector to appear
- introduces polymorphic page.waitFor method, which accepts
either string (and in this case is a shortcut for page.waitForSelector)
or number (and in this case it's a promisified timeout).

References #91.
2017-07-21 12:54:04 -07:00
Andrey Lushnikov
1891a49962 fix documentation for Page.waitFor 2017-07-21 12:14:12 -07:00
Andrey Lushnikov
1f954fa7ed Implement timeout option for page.waitFor
This patch implements timeout option for page.waitFor. The function
will throw if the selector doesn't appear during timeout milliseconds
of waittime.

References #89, #91.
2017-07-21 12:07:48 -07:00
Andrey Lushnikov
52de75742b Implement visible option for Page.waitFor method
This patch adds a 'visible' option to the Page.waitFor method, making
it possible to wait for the element to become actually visible.

References #89, #91.
2017-07-21 10:01:19 -07:00
Andrey Lushnikov
139b9e9b6d Get rid of page.emulate() / page.emulatedDevices() methods
This patch:
- gets rid of `page.emulate` and `page.emulatedDevices`
  methods. Instead, it is suggested to use `page.setViewport()`
  and `page.setUserAgent()` methods.
- moves DeviceDescriptors to the top level of the puppeteer so that
  it is convenient to require them.
- improves on documentation to describe the suggested emulation
  approach.

References #88.
2017-07-20 23:53:06 -07:00
Andrey Lushnikov
76ac3bded5 Convert DevicesDescriptors into puppeteer format
This patch converts lib/DevicesDescriptors from a devtools front-end
format into a puppeteer format.

This patch does this via introducing a scripts utils/fetch_devices.js
which grabs devices from upstream of DevTools Front-end and
converts them into puppeteer devices.

References #88.
2017-07-20 17:49:15 -07:00
Andrey Lushnikov
a63a0198de Implement waitFor which survives navigation (#99)
This patch implements page.waitFor method which survives navigation.

References #89.
2017-07-19 19:04:51 -07:00
JoelEinbinder
febd747c5b Inroduce page.press (#96)
This patch:
- introduces page.press() method
- adds more input tests

References #89
2017-07-19 14:43:07 -07:00
JoelEinbinder
71f8c76f04 Rename keyboard.hold and release to up and down (#95)
References #89
2017-07-19 14:27:01 -07:00
Pavel Feldman
f154d537f7 Introduce page.goBack/page.goForward (#93)
This patch introduces page.goBack/page.goForward methods
to navigate the page history.

References #89.
2017-07-18 19:11:37 -07:00
Pavel Feldman
98c3894c84 Introduce Page.waitForNavigation (#94)
This patch introduces Page.waitForNavigation which allows to wait
for render-initiated navigation.

This patch also does a nice refactoring, replacing Navigator with NavigatorWatcher which
is not a part of a page state.

References #89
2017-07-18 18:54:24 -07:00
Andrey Lushnikov
2ca08b032b Rename Page's 'consolemessage' event into 'console'
This patch:
- renames 'consolemessage' event into 'console'
- improves on 'console' event documentation

References #39.
2017-07-17 20:38:11 -07:00
JoelEinbinder
117a128b42 Introduce Page.$ and Page.$$ (#75)
This patch introduces Page.$ and Page.$$ methods which are
aliases for `document.querySelector` and `document.querySelectorAll`. 

Fixes #78.
2017-07-17 18:56:56 -07:00
JoelEinbinder
bf7698e8f8 Intorduce Page.keyboard (#74)
Introduce page.keyboard to provide low-level access to the keyboard.
2017-07-17 18:49:52 -07:00
Pavel Feldman
895f69d17a Add emulation for named devices. (#72)
This patch introduces page emulation, making it possible to emulate different devices.
2017-07-17 18:13:04 -07:00
Andrey Lushnikov
9eb46d613d [doc] add examples for Dialog and Frame classes 2017-07-17 11:02:13 -07:00
Andrey Lushnikov
b2d2bf822a Rename Page.printToPDF into page.pdf
This patch:
- renames Page.printToPDF into page.pdf
- adds a 'path' option to the page.pdf options instead of a separate
  `filePath` parameter
- improves on the documentation for the `page.pdf`

References #39.
2017-07-17 10:37:33 -07:00
Andrey Lushnikov
6eac22dd87 [doclint] lint events
This patch:
- adds event linting to the doclint
- improves `api.md` to add events and more information about
  classes reported by events.

References #14.
2017-07-14 23:52:13 -07:00
Andrey Lushnikov
560b817d7f Make page.url() return URL synchronously.
page.url() is just a shortcut to page.mainFrame().url().

References #39.
2017-07-14 14:05:27 -07:00
Andrey Lushnikov
34a96a8462 Rename navigation option 'waitFor' into 'waitUntil'.
This patch renames navigation option 'waitFor' into 'waitUntil' to
avoid confusion with 'page.waitFor' call.

References #39.
2017-07-14 13:59:36 -07:00
Andrey Lushnikov
76415e1be5 [doc] distinct naming for functions which are evaluated in page context
This patch renames all the function parameters which are executed in
page context into 'pageFunction'.
2017-07-14 13:51:22 -07:00
Andrey Lushnikov
235001bab3 [doclint] validate return statements
This patch teaches doclint to validate presence of return statements.
It also adds a bunch of documentation to the api.md.

References #14.
2017-07-14 13:04:15 -07:00
Andrey Lushnikov
67d109862a [doclint] parse getters as properties
From the api standpoint, there's no difference between property
and a getter.

References #14.
2017-07-13 23:12:38 -07:00
Andrey Lushnikov
45c20c7dad [doclint] introduce class members
This patch unifies Documentation.Method with Documentation.Property,
making it possible to verify sorting order across methods and
properties.

References #14.
2017-07-13 23:02:43 -07:00
Andrey Lushnikov
38e6f53cc7 [doclint] add linting for class properties
This patch:
- adds linting for class properties
- adds documentation for the missing class properties

References #14.
2017-07-12 09:45:08 -07:00
Andrey Lushnikov
f9283f9d4b [doc] fix link to the InterceptedRequest 2017-07-11 17:07:08 -07:00
Andrey Lushnikov
191ca747fd [doclint] Fix bug in documentation linter
This patch:
- fixes a typo in documentation linter, which resulted in only
  certain method arguments being linted.
- adds missing arguments to the documentation

References #14.
2017-07-11 17:02:13 -07:00
Andrey Lushnikov
7765760186 [doclint] Start linting method arguments
This patch introduces a general Documentation.diff method, which
produces a diff of two documentations.

With this, the patch teaches documentation linter to lint method arguments.

References #14.
2017-07-11 16:43:41 -07:00
Andrey Lushnikov
279cd4c9fb Remote Browser's remoteDebuggingPort option
This patch remove remoteDebuggingPort option. Instead, browser
is launched with '--remote-debugging-port=0' flag, letting browser
to pick any port. The puppeteer reads the port number from the
browser's stderr stream.

This change cuts average browser start time from 300ms to 250ms
on my machine. This happens since puppeteer doesn't have to probe
network once every 100ms, waiting for the remote debugging server to
instantiate.

Fixes #21.
2017-07-11 08:30:41 -07:00
Andrey Lushnikov
50d9c186b5 Change Page.navigate to return main resource response
This patch changes Page.navigate API:
- Page.navigate now resolves to the main page response
- Page.navigate throws errors if there's no main page response,
  e.g. in case of SSL errors, max navigation timeout,
  or invalid url.

This patch also adds httpsServer with a self-signed certificates
for the testing purposes.

Fixes #10.
2017-07-10 18:50:06 -07:00
Nicolas Gryman
a7e91dc126 Fix docs typo in page.screenshot description (#67) 2017-07-10 14:15:20 -07:00
JoelEinbinder
da0cde1b45 Implement Page.uploadFile (#61)
This patch implements `Page.uploadFile` method to support file upload inputs.
2017-07-10 11:21:46 -07:00
Aleksey
090ecfa6b9 Added frame.waitFor(selector) (#59)
This patch adds `frame.waitFor(selector)` method.

Fixes #42.
2017-07-08 01:39:02 +03:00
Andrey Lushnikov
aa5419a577 Fill doc with stubs for missing documentation methods.
This patch fills doc with stubs so that the command `npm run doc`
does not complain.
2017-07-07 10:35:19 -07:00
Andrey Lushnikov
62cacbe5f5 Implement documentation linter (#47)
This patch implements documentation linter, which leaves under `test/doclint`
folder.

The documentation linter works like this:
1. Parse javascript source code with esprima and construct a "documentation" out of source code
2. Generate HTML out of `api.md` and traverse the HTML with puppeteer.
3. Make sure javascript aligns nicely with HTML

The documentation linter adds the following commands:
- `yarn doc` - to test that documentation covers all the relevant apis
- `yarn generate-toc` - to update the table-of-contents for the `api.md`
2017-07-07 19:36:45 +03:00
Andrey Lushnikov
a35a21dfaf Implement NetworkManager
This patch implements NetworkManager, which encapsulates all the
interaction with Network domain.

The NetworkManager also uses partial implementation of Request and
Response classes, defined in the Fetch API specification.

References #26
2017-06-29 11:49:56 -07:00
Andrey Lushnikov
3d90ea38a9 Implement Frame.evaluate
This patch implements Frame.evaluate method.

References #4.
2017-06-27 14:57:14 -07:00
Andrey Lushnikov
4b0b3b5ff5 add stubs for methods in api.md
References #14
2017-06-27 12:15:26 -07:00
Andrey Lushnikov
8e0db60c03 Update api.md
This patch improves on api.md so that the raw md is human-readable
and the rendering is still good.

The next step would be linting markdown so that it's up-to-date and neat.

References #14.
2017-06-21 14:11:52 -07:00
Eric Bidelman
f185ab749f Fix readme example 2017-06-21 14:11:52 -07:00
Andrey Lushnikov
3b0bc0802d Refactor Page.screenshot() api
This patch refactors Page.screenshot api, accoring to the discussion
in #5:
- Page.screenshot accepts single optional options object
- Page.saveScreenshot is removed
- Page.screenshot assumes 'png' screenshot if no type is set and no
  'path' property is given

Fixes #5.
2017-06-16 17:15:24 -07:00
Andrey Lushnikov
163e14345d Remove Page.handleDialog method
This is a left-over after refactoring in f62cfc3b.

References #2.
2017-06-16 11:24:47 -07:00
Andrey Lushnikov
14a75a83ea Merge Page.evaluate and Page.evaluateAsync together
This patch makes Page.evaluate await promise if one is
returned by the evaluated code.

This makes the Page.evaluateAsync unneeded, so the patch
removes it.

Fixes #11.
2017-06-15 14:56:40 -07:00
Andrey Lushnikov
5ba6621cde Remove the Page.setBlockedURLs method
This patch removes the Page.setBlockedURLs method. The
functionality is trivially implementable with the request
interception (see examples/loadurlwithoutcss.js).

Fixes #1.
2017-06-15 08:26:55 -07:00
Andrey Lushnikov
ec414eb774 Rename page.size() and page.setSize() into page.viewportSize()
It turns page.size() and page.setSize() methods are slightly
confusing since there multiple different sizes (layout size,
content size, viewport size..)

This patch renames Page.{size,setSize} methods into
Page.{viewportSize,setViewportSize} methods to avoid confusion.
2017-06-14 07:41:26 -07:00
Andrey Lushnikov
549535e674 Add docs/api.md
This patch adds docs/api.md file which contains API description
for the puppeteer API. This patch adds the API outline, which
doesn't not have explanations and samples.
2017-06-13 00:28:39 -07:00