Commit Graph

134 Commits

Author SHA1 Message Date
Andrey Lushnikov
d71feb63d0 Determine failed navigation based on Frame.unreachedURL (#365)
This patch starts using frame.unreachedURL property from
frameNavigated event to determine if the page navigation
was successful.
2017-08-17 23:24:16 -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
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
Andrey Lushnikov
7cef3d7ce7 Teach page.pdf to respect printBackground argument (#307)
References #301
2017-08-16 15:08:31 -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
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
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
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
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
Andrey Lushnikov
e1d8a3781e Rename Page.navigate into Page.goto (#232)
Fixes #228.
2017-08-10 00:02:10 -07:00
Andrey Lushnikov
fe06c896eb Roll chromium to 492629 (#230)
This patch
- rolls chromium to 492629
- migrates connection establishing to use browser target. This migration means
  that now we have a single websocket connection to browser (implemented
  in Connection class). A connection to a particular target is
  incapsulated in a new Session class.
2017-08-09 16:14:00 -07:00
Andrey Lushnikov
7888a37a3d Page.pdf should accept case-insensetive page format (#211) 2017-08-04 01:01:10 -07:00
Andrey Lushnikov
00196e6cdc Fix setContent to actually await the inner evaluation (#209) 2017-08-04 00:23:04 -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
Andrey Lushnikov
6c163122bf Update default viewport size to be 800px by 600px (#194)
This patch updates default viewport size to be 800px by 600px.
This comes handy when observing scripts running in non-headless mode.
2017-08-02 15:47:00 -07:00
JoelEinbinder
5d647bf1fa Use const a lot fo places (#188) 2017-08-02 12:06:47 -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
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
Andrey Lushnikov
c013a531cf Refactor EmulationManager
This patch refactors EmulationManager so that it is a normal
class with a state.
2017-07-29 19:19:37 -07:00
Pavel Feldman
7fdf800a39 Simplify frame manager, do not fetch resources upfront (#159)
This patch:
- gets rid of Page.getResourceTree() protocol method
- rolls chromium to 490379

Fixes #127
2017-07-28 16:52:38 -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
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
b9e3cce5fd Fail navigation when main resource fails to load
This patch fails navigation when the main resource fails to load.

Fixes #148.
2017-07-27 17:54:39 -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
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
Pavel Feldman
585f815548 Don't use Emulation.resetPageScaleFactor (#147)
Instead of using Emulation.resetPageScaleFactor, this patch starts using clip's scale for
fullPage screenshots.
2017-07-26 15:28:44 -07:00
Pavel Feldman
5068185d03 Don't ever enable DOM domain. (#145)
This patchs makes sure DOM domain is never enabled. The reasoning behind this is that
DOM domain is heavy-weight: it generates a lot of traffic over the protocol.

Drive-by: use Page.addScriptToEvaluateOnNewDocument instead of Page.addScriptToEvaluateOnLoad
2017-07-26 15:19:43 -07:00
JoelEinbinder
9363a15cce Small fixes to jsdoc (#140)
References #65.
2017-07-26 09:58:03 -07:00
Pavel Feldman
f455e3a1e4 Remove NetworkManager usage from NavigatorWatcher (#134) 2017-07-25 16:06:53 -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
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
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
5549ad0282 Do not serialize remote objects unless needed
This patch stops serializing console API arguments unless there are
listeners of the 'console' event in puppeteer.

This saves quite a lot CPU cycles.

Fixes #117.
2017-07-24 21:43:54 -07:00
JoelEinbinder
fdaaa2c0e6 Inject file with sourceURL (#102)
This patch starts adding a sourceURL trailing comment to make stack traces
readable.
2017-07-23 09:56:35 -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
aba61de905 Make helper.getExceptionMessage synchronous
We now have description of an exception, no need for a roundtrip
to the backend.
2017-07-21 11:57:25 -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