Commit Graph

679 Commits

Author SHA1 Message Date
Slohmes
5a6488883a feat(Tracing): allow custom tracing categories (#1439)
This patch adds `categories` option to the `page.tracing.start` method
that allows to override default tracing categories. 

References #1300, #854
2017-12-03 18:36:34 -08:00
calebboyd
42fd41c499 chore: use string literal in require for index.js (#1511)
Use string literals for `require` statement in `index.js` so that tools can determine the dependency tree.
2017-12-03 17:27:36 -08:00
JoelEinbinder
c58c70eac0 test: deflake tween mouse test (#1515)
When mojo is enabled for input events, we sometimes get an extra mouse move after the page is created. Moving the mouse ourselves makes the test consistent. The same behavior also caused DevTools dispatchMouseEvent to become flaky, but that will be fixed with: https://chromium-review.googlesource.com/c/chromium/src/+/804357
2017-12-03 17:15:13 -08:00
Andrey Lushnikov
2becd156d0
feat(Chromium): roll Chromium to r518818 (#1455)
This roll includes:
- crrev.com/518362 DevTools: override referrer policy for the request if
  referer header is overriden

Fixes #1373.
2017-11-23 07:42:48 +03:00
Trent Willis
770c17b2ea feat(Frame): implement frame.content and frame.setContent methods (#1447)
This refactors the page.content and page.setContent methods to be defined on the Frame class. This allows access from the Page still but also on all frames.

Fixes #754
2017-11-23 05:44:33 +03:00
Andrey Lushnikov
3b60ad1c39
doc(api.md): ElementHandle.boundingBox() returns a promise (#1437) 2017-11-21 10:13:44 +03:00
Andrey Lushnikov
88eaede5ad
fix(page): fix "timeout: 0" to actually disable any navigation timeout (#1435)
Since non-promise values always win the `Promise.race`, we shouldn't
return `null` for timeout promise in NavigationWatcher.

Instead, we can return a promise that never resolved. It should be
GC'd later with the navigation watcher itself.

Fixes #1417.
2017-11-21 08:21:25 +03:00
Andrey Lushnikov
cafd040bf2
fix(Network): be prepared to miss requestWillBeSent events (#1420)
With the addition of `browser.targets()` api, we now can connect to
in-flight targets.

For Puppeteer, it means that it can "miss" certain events happenning
while it wasn't attached to the target.

This patch:
- fixes this problem with NetworkManager, preparing it for the
  missed `requestWillBeSent` event.
- adds a new test to ensure that not a single unhandled promise
  rejection has happened during test execution.

Fixes #1363.
2017-11-20 15:59:07 -08:00
Andrey Lushnikov
ea70ac9003
fix(Page.goto): check navigation completeness on frame detachment (#1419)
Currently, the NavigatorWatcher ensures that all the frames in the
frame subtree reach the desired lifecycle events state.

For this to be fully correct, NavigatorWatcher should also check
navigation status whenever frames are detached.
2017-11-20 14:47:11 -08:00
Andrey Lushnikov
6512ce768d
fix(Frame): postpone evaluations until execution context gets created (#1415)
In Blink, frames don't necesserily have execution context all the time.
DevTools Protocol precisely reports this situation, which results in
Puppeteer's frame.executionContext() being null occasionally.

However, from puppeteer point of view every frame will have at least a
default executions context, sooner or later:

- frame's execution context might be created naturally to run frame's
  javascript
- if frame has no javascript, devtools protocol will issue execution
  context creation

This patch builds up on this assumption and makes frame.executionContext()
to be a promise.
As a result, all the evaluations await for the execution context to be created first.

Fixes #827, #1325

BREAKING CHANGE: this patch changes frame.executionContext() method to return a promise.
To migrate onto a new behavior, await the context first before using it.
2017-11-18 16:27:52 -08:00
Md. Abu Taher
48ccf1e9f4 doc(api.md): add evaluateOnNewDocument examples (#1202)
Fixes #1201.
2017-11-17 10:34:20 -08:00
Andrey Lushnikov
90ca007367
fix(Launcher): handle SIGHUP signal (#1405)
The SIGHUP signal is sent whenever the controlling terminal is closed.

On Windows, SIGHUP is emulated by libuv, and will be the only signal we
receive before the application will be terminated.

This patch starts handling SIGHUP in the same way we handle SIGTERM.

Fixes #1367.
2017-11-16 19:28:32 -08:00
Octavian Cioaca
a350e89381 chore(Browser): fix jsdoc in Browser.create method (#1403) 2017-11-16 16:28:52 -08:00
Andrey Lushnikov
cc0c461ea8
fix(Launcher): handle SIGTERM by default (#1402)
SIGTERM signal is widely used to notify application that it will be shut down.

This patch starts listening to SIGTERM event to gracefully retire
chromium instance.

References #1047.
2017-11-16 14:26:32 -08:00
Sean Tan
d8ac8fcfb0 docs(api.md): fix return signatures that contains null (#1364) 2017-11-15 10:53:17 -08:00
Andrey Lushnikov
99103cbb97
chore: bump version to 1.0.0rc (#1389) 2017-11-14 15:58:11 -08:00
Andrey Lushnikov
0467c346b1 chore: mark version 0.13.0 2017-11-10 18:16:20 -08:00
Christopher Dieringer
b0b22199f9 fix(ElementHandle.screenshot): account for scroll (#1323)
Currently, `elementHandle.screenshot` passes bounding box into the `page.captureScreenshot` 
method.
This is wrong since `captureScreenshot` accepts viewport, not bounding box.

This patch uses layout metrics to convert bounding box into viewport.

Fixes #1315.
2017-11-10 16:02:52 -08:00
Andrey Lushnikov
2c8f658815
fix(Navigation): wait for lifecycle events for the frame subtree (#1356)
Currently, we wait only for the main frame to reach the desired
lifecycle state.

This patch starts waiting until all the frames reach the desired
lifecycle state.

Fixes #1173.
2017-11-10 15:44:14 -08:00
JoelEinbinder
f8d19e79e7 fix(Page.waitForSelector): "visible" option should check parent visibility (#1354)
This patch starts checking for boundingClientRect to make sure that the
element is visible.
2017-11-10 15:44:01 -08:00
Andrey Lushnikov
44d1e834a4
fix(Navigation): correctly wait for navigation in Page.goto (#1355)
This patch:
- starts persisting lifecycle state for every frame
- migrates NavigationWatcher to rely on these lifecycle events
- refactors Page.goto to properly return navigation errors

Fixes #1218.
2017-11-10 15:33:14 -08:00
Robin
9b907b9ada docs(api): javascript -> JavaScript (#1338) 2017-11-10 13:35:22 -08:00
Andrey Lushnikov
9c1935b651
feat(Chromium): roll chromium to r515411 (#1346)
This roll includes the following revisions:
- crrev.com/515281 DevTools: fix crash on intercepting request that
  posts a blob
- crrev.com/515368 DevTools: wait for navigation to be committed
  upon Page.navigate on the browser side.

Fixes #894, References #1218
2017-11-10 00:35:16 -08:00
Andy() {/** ... */}
7075c4cd4f docs(troubleshooting): fix typo (#1327)
This patch fixes typo from `6MB` to `64MB`
2017-11-09 10:26:49 -08:00
Alix Axel
7d18275fb9 Test: add tests to cover clicking checkbox (#1125)
This patch adds tests to make sure clicking both checkbox and its label
works.

These are regression tests to cover the upstream fix, rolled in #1299.
2017-11-07 20:38:22 -08:00
Tomas Alabes
73f5b806a3 fix(install): support for npm no_proxy (#1314)
This patch adds support for npm `no_proxy` configuration for the installation script.
2017-11-07 20:16:22 -08:00
JoelEinbinder
b7566c1a83 docs: document osx keyboard shortcuts not working (#1311)
Fixes #776
2017-11-07 16:22:58 -08:00
Andrey Lushnikov
cbe3dc58a2
Revert "feat(Page): teach Page.setContent to wait for resources to load (#1152)" (#1312)
This reverts commit 80ee469429.

Lifecycle events are not ready yet to support the setContent scenario.
The prerequisite for this is
https://chromium-review.googlesource.com/c/chromium/src/+/747805 that
might not land soon due to technical concerns.
2017-11-07 14:18:05 -08:00
JoelEinbinder
b58d319926 fix(Page.click): throw a meaningful message for invisible elements (#1309)
This patch starts throwing a meaningful error message when trying to click the hidden
node.

References #1294
2017-11-07 13:54:40 -08:00
JoelEinbinder
3cb0f1af34 fix: make exposeFunction work for frames (#1295)
This patch fixes page.exposeFunction method so that it
adds exposed binding to all existing frames.

Fixes #690
2017-11-07 13:26:23 -08:00
Eric Bidelman
8c9332b62e docs(Readme): add loading extensions example (#1308)
This patch adds a tips-and-tricks section to the `readme.md` that explains
how to load extension to puppeteer.
2017-11-07 13:19:54 -08:00
Schelkun
77f585298f feat(Page): introduce Page bringToFront method (#1252)
This patch introduces Page.bringToFront method to activate tabs.

Fixes #1244
2017-11-07 13:17:36 -08:00
Eric Bidelman
9de34499ef
Additional Docker tips (#1235)
* block-images - use news.google.com

Address insecure content errors as seen on https://github.com/ebidel/try-puppeteer/issues/7.

* docs(troubleshooting.md): addition Docker tips

Fixes #809

* add dumb-init
2017-11-07 10:27:02 -08:00
Andrey Lushnikov
a467d35a5f chore(doclint): do not attempt to lint non-documentation markdown 2017-11-07 03:33:25 -08:00
Robert Sköld
cc5e8a9bd4 fix(Page.type): Add assertion to page.type() (#1301)
This patch starts throwing a nice error when `page.type` is called
with non-existent selector.
2017-11-07 03:07:51 -08:00
JoelEinbinder
2f7c77875e feat: roll chromium to r514418 (#1299)
Rolls Chromium to [r514418](https://crrev.com/514418).

This roll includes:
- https://crrev.com/514020 - DevTools: Convert DOM.getBoxModel to use CSS pixels
- https://crrev.com/513738 - Headless: use cookie encryption to match non-headless mode

Fixes #1082, fixes #1126, fixes #921
2017-11-07 01:23:29 -08:00
Xingan Wang
8e445734c6 feat(Frame): reject error for addScriptTag/addStyleTag (#1287)
fix #1221
2017-11-06 22:04:40 -08:00
Alessio Occhipinti
bdd5718630 docs(examples): added pupperender (#1293)
* doc(examples): added pupperender

* review fixes

* review fixes 2
2017-11-06 13:13:27 -08:00
Andrey Lushnikov
5e154dc835
fix(Page.select): assert all values are of type "string". (#1280)
This patch starts asserting that all values are of type "string".

The alternative approach to cast values to strings
might yield a hard-to-debug errors.

Fixes #1276.
2017-11-03 19:20:12 -07:00
Adi Prasetyo
03fefb53f8 feat(browser): add browser.disconnected event (#960)
This patch adds a 'disconnected' event for the browser. The event is issued
when the "browser" loses connection to the chrome process.

References #952
2017-11-03 18:46:17 -07:00
Andrey Lushnikov
88ba52a363
refactor: use Page.getFrameTree instead of Page.getResourceTree (#1275)
This patch starts using Page.getFrameTree instead of
Page.getResourceTree.

The resource tree is experimental, whereas the frame tree is not.
2017-11-03 18:37:21 -07:00
Vse Mozhet Byt
7bc55ab7fd docs(api.md): fix return values of page.add*Tag() (#1269) 2017-11-03 09:32:17 -07:00
Xingan Wang
e0f5b93923 feat(Frame): addStyleTag and addScriptTag now return ElementHandles.
This patch teaches `page.addStyleTag` and `page.addScriptTag` to return ElementHandles
to the added tags.

Fixes #1179.
2017-11-03 00:05:38 -07:00
Andrey Lushnikov
f08f33458f
test: validate headless reading cookies written by headful (#1266)
This test ensures that Chrome Headless can successfully read cookies written
by Chrome Headful.

References #921
2017-11-03 00:02:41 -07:00
Vse Mozhet Byt
cee3081a41 docs(api.md): fix return value of frame.select() (#1251) 2017-11-02 21:46:49 -07:00
Andrey Lushnikov
ac55e69676
feat(Chromium): roll chromium to r513435. (#1259)
This roll brings in a bunch of important patches:
- crrev.com/512647 Changed headless browser profile dir to use Default profile path
- crrev.com/512760 DevTools: stop idleness detector when pending navigation commits
- crrev.com/512905 DevTools: introduce Page.getFrameTree
- crrev.com/513373 DevTools: report loaderId in the lifecycle events
- crrev.com/513419 DevTools: introduce Page.setLifecycleEventsEnabled
- crrev.com/513422 DevTools: return loaderId from Page.navigate

Fixes #921 

BREAKING CHANGE:

Headless user profile structure is changing. Custom profiles set with --user-data-dir flag will no longer be read in Chrome 63 and will have to be recreated.

Alternatively, you can migrate old headless profile to a new structure. if you stored your profile in `<profile>` folder, you would run the following bash commands:

```bash
cd <profile>
mkdir Default
mv * Default
```

Full headless-dev PSA announcement: https://groups.google.com/a/chromium.org/forum/#!msg/headless-dev/asX8WgktXIE/zTUfmHDcAQAJ
2017-11-02 13:26:21 -07:00
Suvrat Jain
fede2643ac feat(Frame): introduce Frame.select
This patch adds `Frame.select` method that does the same functionality as
former `Page.select`, but on a per-frame level.

The `Page.select` method becomes a shortcut for the ÷main frame's select.

Fixes #1139
2017-11-01 22:06:04 -07:00
Andrey Lushnikov
bc7f211474
docs(contributing): define semantic commit message rules (#1233)
Semantic commit messages drastically simplify preparation of releases.
2017-11-01 14:05:19 -07:00
Andrey Lushnikov
f5bb333cd0
fix: support PlzNavigate in puppeteer. (#1239)
This patch migrates puppeteer to support PlzNavigate chromium
project.

As a consequence of this patch, we no longer wait for both
requestWillBeSent and requestIntercepted events to happen. This should
resolve a ton of request interception bugs that "hanged" the loading.

Fixes #877.
2017-11-01 14:04:10 -07:00
Andrey Lushnikov
b9266c74f8
feat(Page): rename Page.getMetrics into Page.metrics (#1240)
BREAKING CHANGE: method page.getMetrics() got renamed into
page.metrics().
2017-11-01 13:39:31 -07:00