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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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
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
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.
Currently, NavigationWatcher listens to lifecycle events from Page
domain and security events from Security domain.
However, the events are dispatched from different processes in browser:
- Page's lifecycle events are dispatched from renderer process
- Security events are dispatched from browser process
This makes for the undefined order between events and results in
NavigationWatcher reporting different failuer messages, based on
the event order.
This patch stops relying on security errors in navigation watcher and
instead switches to request failure codes for the main resource.
Fixes#1195