Commit Graph

58 Commits

Author SHA1 Message Date
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