Commit Graph

69 Commits

Author SHA1 Message Date
Andrey Lushnikov
47fbb117f5
test(firefox): add more Puppeteer-Firefox tests to Puppeteer (#3892)
References #3889
2019-02-02 12:55:15 -07:00
Andrey Lushnikov
a2f1e2774a
fix: ignore console messages from destroyed execution contexts (#3866)
Fix #3865
2019-01-30 16:19:02 -08:00
Andrey Lushnikov
a064a6341b
feat(page): introduce page.setDefaultTimeout (#3854)
Method `page.setDefaultTimeout` overrides default 30 seconds timeout
for all `page.waitFor*` methods, including navigation and waiting
for selectors.

Fix #3319.
2019-01-28 17:16:12 -08:00
Andrey Lushnikov
678b8e85ad
fix(page): use secondary DOMWorld to drive page.select() (#3809)
This patch starts creating secondary DOMWorld for every connected
page and switches `page.select()` to run inside the secondary world.

Fix #3327.
2019-01-22 17:55:33 -05:00
Andrey Lushnikov
89fc2adff5
fix(page): consoleMessage.location() should work with workers (#3752)
This patch:
- refactors consoleMessage.location() implementation to
make it work for workers
- re-writes tests to avoid 5 second delay
2019-01-10 18:05:28 -08:00
Tom P
0c867631b0 feat(page): introduce consoleMessage.location() (#3365)
This patch adds a new consoleMessage.location() method that returns console message origins.

Fixes #3029
2019-01-10 16:51:13 -08:00
Andrey Lushnikov
3d82465f66
fix(page): fix repetitative setContent calls (#3666)
Fix #3665.
2018-12-13 13:33:42 -08:00
Andrey Lushnikov
8aaca4eb1e
feat(page): introduce "Popup" event (#3661)
This patch adds a new "popup" event for page.
"Popup" event is fired whenever page opens another page with
given opener.
2018-12-12 17:09:42 -08:00
Andrey Lushnikov
c90392bdf5
feat: introduce page.browserContext() (#3655) 2018-12-12 15:08:31 -08:00
Andrey Lushnikov
6656519560
test: split out dialog tests (#3586) 2018-11-20 20:18:57 -08:00
Andrey Lushnikov
309cbe625f
test: split out navigation tests (#3585) 2018-11-20 20:09:25 -08:00
Andrey Lushnikov
d61916b53e
test: split out evaluation tests (#3584) 2018-11-20 19:59:59 -08:00
Andrey Lushnikov
a181bdde31
test: split out emulation tests (#3581) 2018-11-20 19:17:56 -08:00
Andrey Lushnikov
a5b1978190
test: split out waittask tests (#3580) 2018-11-20 18:57:28 -08:00
Andrey Lushnikov
e5830d1199
test: split queryselector tests into separate file (#3579) 2018-11-20 18:45:37 -08:00
Andrey Lushnikov
aa9fb82f14
test: split screenshot tests into separate file (#3578) 2018-11-20 18:32:42 -08:00
Andrey Lushnikov
927d0f443b
feat(page): support waitUntil option for page.setContent (#3557)
This patch teaches `page.setContent` to await resources in
the new document.

**NOTE**: This patch changes behavior: currently, `page.setContent`
awaits the `"domcontentloaded"` event; with this patch, we can now await
other lifecycle events, and switched default to the `"load"` event.

The change is justified since current behavior made `page.setContent`
unusable for its main designated usecases, pushing our client
to use [dataURL workaround](https://github.com/GoogleChrome/puppeteer/issues/728#issuecomment-334301491).

Fixes #728
2018-11-20 15:32:46 -08:00
Andrey Lushnikov
e2e43bc23d
fix(page): navigating 11 pages simultaneously should not throw warning (#3560)
NavigatorWatcher subscribes to Connection to get a `Disconnected` event,
causing us to hit the default max of 10 listeners constraint.

Technically we don't leak anything here and can safely bump
the maxListenersCount to Infinity.

However, we conveniently have `CDPSession`, and
can re-dispatch the event on it and keep the safety check in place.
2018-11-20 14:21:13 -08:00
Andrey Lushnikov
95a19c74bc
fix(page): dispatch errors into page (#3550)
Errors thrown on the node side of the `page.exposeFunction` callback
should be dispatched into the page.

Fixes #3549
2018-11-15 14:51:34 -08:00
Andrey Lushnikov
3596c5f7e2
fix(page.evaluate): better function serialization (#3480)
References #1665
2018-11-01 16:43:21 -07:00
Andrey Lushnikov
8becb31754
test: add failing test for page.select (#3346)
References #3327.
2018-10-04 10:41:38 -07:00
Andrey Lushnikov
5acf953104
feat(frame): introduce Frame.goto and Frame.waitForNavigation (#3276)
This patch introduces API to manage frame navigations.
As a drive-by, the `response.frame()` method is added as a shortcut
for `response.request().frame()`.

Fixes #2918.
2018-09-20 11:31:19 -07:00
Andrey Lushnikov
0b9d8a6271
feat: async stacks for all "async" public methods (#3262)
This patch traces all public async methods and wraps them
in a helper method that tags the sync stack trace.

Later on, if the method call throws an exception, we add
a captured stack trace to the original stack trace with the "--ASYNC--"
heading.

An example of a stack trace:

```
Error: net::ERR_ABORTED at http://localhost:8907/empty.html
    at navigate (/Users/lushnikov/prog/puppeteer/lib/Page.js:622:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at Page.<anonymous> (/Users/lushnikov/prog/puppeteer/lib/helper.js:147:27)
    at fit (/Users/lushnikov/prog/puppeteer/test/page.spec.js:546:18)
    at process._tickCallback (internal/process/next_tick.js:68:7)
```
2018-09-19 13:54:58 -07:00
Łukasz Usarz
d929f7e213 fix: set JPG background to white when omitBackground option is used (#3240)
Fixes #3234
2018-09-14 11:03:33 +01:00
Andrey Lushnikov
d54c7edeae
fix(page): Page.goto should properly handle historyAPI in beforeunload (#3198)
Fixes #2764.
2018-09-05 22:59:29 +01:00
Andrey Lushnikov
22c0ce63ce
test: cleanup newly added test for navigation referer (#3179)
Make sure that referer that is passed as `page.goto` option doesn't
override subrequest referers.
2018-09-04 19:05:48 +01:00
Ali Ahmad
464f3b4ca2 feat(page): Add 'referer' as a parameter to Page.goto() (#3128)
If referer is passed to the options object its value will be used as the referer instead of the value set by `Page.setExtraHTTPHeaders()`.

This is the correct way to set referer header: otherwise, the `referer` header will override all the document subrequests.

Fixes #3090.
2018-09-03 20:06:58 +01:00
Andrey Lushnikov
17029281a9
feat(page): Introduce page.setGeolocation method (#3160)
Fixes #1077
2018-08-31 18:04:12 +01:00
Andrey Lushnikov
50d6c2d3c6
feat(browsercontext): implement BrowserContext.overridePermissions (#3159)
Introduce an API to manage permissions per browser context:
- BrowserContext.overridePermissions(origin, permissions)
- BrowserContext.clearPermissionOverrides()

Fixes #846.
2018-08-30 23:36:09 +01:00
Andrey Lushnikov
df459ba6cd
feat(chromium): roll Chromium to r587164 (#3153)
This roll includes:
- https://crrev.com/584293 - DevTools: execute scripts in addScriptToEvaluateOnLoad in order
- https://crrev.com/585630 - DevTools: introduce Browser.grantPermissions
- https://crrev.com/587156 - Revert "[Base] Use background mode for ThreadPriority::BACKGROUND threads (behind feature) (reland)."

The "revert" patch fixes headless functionality on windows.

References #846.
Fixes #3106.
2018-08-30 01:02:53 +01:00
Andrey Lushnikov
be7626fa5e
fix: revert ExecutionContext reporting. (#3058)
It turned out that almost any usecase requires helper methods to access
DOM inside the ExecutionContext.

Instead of exposing execution contexts as-is, we should introduce
IsolatedWorld as a first-class citizen that will hold execution contexts
inside.
2018-08-09 18:14:21 -07:00
Andrey Lushnikov
204c7ec8c4
feat: introduce puppeteer/Errors (#3056)
This patch adds a new require, `puppeteer/Errors`, that
holds all the Puppeteer-specific error classes.

Currently, the only custom error class we use is `TimeoutError`. We'll
expand in future with `CrashError` and some others.

Fixes #1694.
2018-08-09 16:51:12 -07:00
Andrey Lushnikov
231a2be971
feat: expose frame's execution contexts (#3048)
This patch exposes frame's execution contexts, making it possible
to debug extension's content scripts.

This is a resurrected #2812.
2018-08-09 14:57:08 -07:00
Andrey Lushnikov
0c49bf5245
test: use new browser context for every page test (#3010)
This allows us:
- dogfood browser contexts the way we want them to be used
- simplifies the dance around service workers / cookies setting up and tier down.
2018-08-01 15:49:41 -07:00
Andrey Lushnikov
0c825de1f8
test: unflake page test that was causing us a lot of CI flakes (#2993) 2018-07-30 18:36:33 -07:00
Andrey Lushnikov
66fa0d3d53
test: cleanup page.waitForRequest/page.waitForResponse tests (#2880)
This patch removes unnecessary regexp tests and unifies all tests
between each other.
2018-07-12 15:32:18 -07:00
Matthew Shirley
726c8dc046 feat(page): introduce waitForRequest and waitForResponse methods (#2776)
This patch introduces `page.waitForRequest` and `page.waitForResponse` helper methods.

Fixes #2362
2018-07-12 14:36:31 -07:00
Andrey Lushnikov
871b204fd1
refactor: simplify EmulationManager (#2816)
EmualationManager used to be injecting touch hooks to properly
support touch emulation.

However, these are no longer necessary, since https://crbug.com/133915
is long fixed.
2018-06-28 18:48:44 -07:00
Andrey Lushnikov
6ca43cf761
docs(api.md): clarify docs about waitForNavigation (#2788) 2018-06-26 13:42:50 -07:00
Andrey Lushnikov
4178b989d2
test: add test that breaks subsequent page.goto (#2775)
References #2764.
2018-06-20 13:51:47 -07:00
Andrey Lushnikov
37dbfc2608
test: fix random tests flakiness (#2770)
These tests were not awaiting `page.evaluate` command, so
page could have been closed before the command returned.
2018-06-19 10:35:13 -07:00
Andrey Lushnikov
c430138845
test: drop PDF tests (#2744)
We fully rely on upstream PDF functionality. Our PDF tests are inferior
to those upstream and inconvenient to write.
2018-06-14 16:42:10 -07:00
Joel Einbinder
73f9c48081 feat: nicer protocol error messages (#2742)
This patch:
- stops appending `undefined` to our protocol messages unnecessarily.
- rewrites `Cannot find execution context id` to `Execution context was destroyed, most likely because of a navigation.` when it occurs from a Puppeteer ExecutionContext. The error message is left alone if it occurs via a CDPSession.
2018-06-14 15:27:59 -07:00
Georgii Dolzhykov
9498b1057b fix(helpers): support thrown strings and numbers in getExceptionMessage (#2715)
Of course, strings aren't proper errors, but scripts sometimes do that, and Puppeteer loses such error messages.
2018-06-14 10:23:13 -07:00
Joel Einbinder
2ff0adcad8 feat: worker convenience methods (#2677)
This patch:
- adds `worker.evaluate` and `worker.evaluateHandle` methods as a shortcut to their execution context equivalents.
- makes the error messages a bit nicer when interacting with a closed worker (as opposed to a closed page).
- moves the worker tests into their own spec file.
2018-06-06 20:16:17 -05:00
Joel Einbinder
1c2adf61e9 fix(workers): workaround worker execution context flakiness (#2596)
Some of the worker tests were failing on the bots. After investigating, I found one race in the test, and one race upstream in Chromium which I filed upstream as https://crbug.com/846099. But I added a small hack here as a temporary workaround.

References #2632
2018-05-30 18:08:27 -07:00
Yotam Laufer
469b910a2d feat(page): allow screenshot to return a base64 string (#2586)
Fixes #2566
2018-05-30 14:27:08 -07:00
Alex Veligura
32f4c173c8 feat(page): add page.isClosed method (#2588)
Fixes #2501.
2018-05-25 16:53:57 -07:00
Joel Einbinder
93fe2b57d6 feat(Page): introduce workers (#2560)
This adds `page.workers()`, and two events `workercreated` and `workerdestroyed`. It also forwards logs from a worker into the page `console` event.

Only dedicated workers are supported for now, ServiceWorkers will probably work differently because they aren't necessarily associated with a single page.

Fixes #2350.
2018-05-21 14:31:11 -07:00
Joel Einbinder
1d225cfa17 fix: allow user gesture restricted code to be run in page.evaluate (#2503)
Fixes #2502
2018-05-04 21:45:16 +03:00