Commit Graph

934 Commits

Author SHA1 Message Date
Alex Rudenko
a566263ba2
fix: apply OOPIF offsets to bounding box and box model calls (#7906)
The doc for boundingBox says that it should return the boundingBox
relative to the main frame, therefore, this fix would make the
actual implementation correspond to the documentation. boxModel
documentation does not have this note but I think it'd make sense
to have it match the behaviour of the boundingBox API.
2022-01-17 14:19:43 +01:00
Alex Rudenko
d7937b806d
fix: error for pre-existing OOPIFs (#7899)
Issues: #7844, #7896
2022-01-17 07:00:00 +00:00
Alex Rudenko
486bbe010d
fix: correctly compute clickable points for elements inside OOPIFs (#7900)
Issues: #7849
2022-01-17 07:32:52 +01:00
Alex Rudenko
8d8e874b07
fix: make sure ElementHandle.waitForSelector is evaluated in the right context (#7843)
So it appears that all bindings are added to the secondary world and all
evaluations are also running there. ElementHandle.evaluate is returning
handles from the main world though. Therefore, we need to be careful
and adopt handles to the right context before doing waitForSelector
So it appears that all bindings are added to the secondary world and all
evaluations are also running there. ElementHandle.evaluate is returning
handles from the main world though. Therefore, we need to be careful
and adopt handles to the right context before doing waitForSelector.
2021-12-21 09:53:20 +01:00
Alex Rudenko
1c44551f1b
fix: predicate arguments for waitForFunction (#7845)
The same predicate function is used by the waitForFunction
API that does not need the context element.

Issues: #7836
2021-12-15 08:40:56 +00:00
Alex Rudenko
36207c5efe
fix: disable a test failing on Firefox (#7846) 2021-12-15 09:17:56 +01:00
Ben Allfree
824242246d
fix!: typo in 'already-handled' constant of the request interception API (#7813)
Issues:  #7745, #7747, #7780
Co-authored-by: Rodrigo Fernández <fdez.romero@gmail.com>
2021-12-09 14:57:40 +00:00
Alex Rudenko
c03429444d
feat: implement Element.waitForSelector (#7825)
Co-authored-by: Johan Bay <jobay@google.com>
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-12-09 11:51:14 +00:00
Ben Allfree
dc23b7535c
feat: expose HTTPRequest intercept resolution state and clarify docs (#7796)
Co-authored-by: Rodrigo Fernández <fdez.romero@gmail.com>
2021-12-07 08:48:42 +01:00
Ben Allfree
636b0863a1
fix: handle multiple/duplicate Fetch.requestPaused events (#7802)
Issues: #7475, #6696, #7225
2021-12-03 20:13:44 +01:00
Alex Rudenko
a26b12b7c7
fix: parse statusText from the extraInfo event (#7798)
Issues: #7458
2021-11-26 09:17:34 +01:00
Alex Rudenko
ac162c561e
feat(chromium)!: roll to Chromium 97.0.4692.0 (r938248)
Issues: #7458
2021-11-23 08:19:14 +01:00
Henrik Skupin
4c3caaa3f9
chore: re-enable tests for Firefox related to fixed Input.dispatchMouseEvent issues (#7776)
Issues: #7115
2021-11-19 08:50:31 +01:00
Henrik Skupin
790c7a0eb9
feat: support for custom user data (profile) directory for Firefox (#7684)
When using a custom Firefox profile for Puppeteer the modified
preferences as present in prefs.js need to be reset once the
profile is no longer needed by Puppeteer. If not done this could
cause side-effects when the profile is used next time outside
of Puppeteer.

As ride-along fix the "--foreground" argument for Firefox will
only be used on MacOS because that's the only supported platform.
2021-11-10 13:31:15 +01:00
Andy Earnshaw
b0319ecc89
fix(ariaqueryhandler): allow single quotes in aria attribute selector (#7750)
This updates the regular expression used to parse aria attribute
selectors so that single quotes may be used as an alternative to double
quotes, e.g. `aria/Single button[role='button']`.

Issues: #7721

Co-authored-by: Andy Earnshaw <andy.earnshaw@gmail.com>
2021-11-09 13:05:10 +01:00
Jan Scheffler
03c9ecca40
feat: improve error message for response.buffer() (#7669) 2021-10-29 13:44:40 +00:00
Jan Scheffler
4d9dc8c0e6
feat(oop iframes)!: integrate OOP iframes with the frame manager (#7556)
This pull request to adds better support for OOP iframes (see #2548)

The current problem with OOP iframes is that they are moved to a different target. Because of this, the previous versions of Puppeteer pretty much ignored them.
This change extends the FrameManager to already take OOP iframes into account and hides the fact that those frames are actually in different targets.
Further work needs to be done to also make the NetworkManager aware of these and to make sure that settings like emulations etc. are also properly passed down to the new targets.
2021-10-28 11:25:49 +02:00
Jan Scheffler
07febca04b
feat: handle unhandled promise rejections in tests (#7722)
In some situations, Puppeteer is left in an invalid state because protocol errors that could have been handled by the user where just hidden from them. This patch removes some of these cases and also makes sure that unhandled promise rejections lead to a test failure in mocha.
2021-10-27 13:43:57 +02:00
Jan Scheffler
2d37430838
chore: update types for JSHandle (#7650)
Closes #7583
2021-10-07 16:04:08 +00:00
Edgard Lorraine Messias
d0cb9436a3
fix(page): fix page.off method for request event (#7624)
This patch fixes page.off for request event

Closes: #7572
2021-10-04 06:59:46 +00:00
Mikkel Snitker
fd607b1095
chore: propagate 'Invalid header' errors (#7020)
Enable developers to handle 'Invalid header' errors instead of hiding them to make sure they can address them properly.
Co-authored-by: Jan Scheffler <janscheffler@chromium.org>
2021-10-04 06:18:03 +00:00
Josh Grime
44c9ec67c5
fix(page): fallback to default in exposeFunction when using imported module (#6365) 2021-09-29 18:32:49 +02:00
Jan Scheffler
a271145b06
feat: add initiator to HTTPRequest (#7614)
Co-Authored-By: atersolis <atersolis@atersolis.net>
2021-09-29 15:14:21 +00:00
Tan Li Hau
26145e9a24
feat: add custom debugging port option (#4993) 2021-09-29 16:05:18 +02:00
Darío Kondratiuk
7069cfedda
test: remove duplicated test on jshandle.spec.ts (#7606)
`should work with primitives` is a duple of `should use the same JS wrappers`
2021-09-28 09:26:42 +00:00
Jan Scheffler
113489d3b5
fix(launcher): launcher.launch() should pass 'timeout' option #5180 (#7596)
Co-authored-by: Bob Jamison <bob.jamison@pearson.com>
2021-09-27 10:01:35 +02:00
dmitrysteblyuk
f2e19276ac
chore: add hared TaskQueue for page.screenshot() again (#6714) 2021-09-23 14:37:35 +02:00
Alex Rudenko
7341d9fadd
fix: request an animation frame to fix flaky clickablePoint test (#7587)
Sometimes an element has not been layed out yet and, in this case,
clickablePoint fails because backend cannot compute content quads.

Co-authored-by: Jan Scheffler <janscheffler@chromium.org>
2021-09-22 12:48:24 +02:00
Jonathan Church
43a9268325
feat: add webp to screenshot options (#7565) 2021-09-21 14:26:20 +00:00
Alex Rudenko
99ca842124
feat(page): expose page.client() (#7582)
Puppeteer already allows creating a new CDP session
via target.createCDPSession but there is no way
to get access to any existing session to send
some additional commands.
2021-09-21 07:39:47 +00:00
Alex Rudenko
2b5c0019dc
feat: add ability to specify offsets for JSHandle.click (#7573)
Until now, the click would be always sent to the middle
point of the target element. With this change, one can define
offsets relative to the border box of the elements and click
different areas of an element.
2021-09-20 09:01:32 +00:00
Max White
eda5171279
feat: add durableStorage to allowed permissions (#5295) 2021-09-16 10:35:36 +00:00
Ron0115
54c4318016
feat: add threshold to Page.isIntersectingViewport (#6497) 2021-09-15 22:56:50 +02:00
Yosuke Kurami
cb4470a6d9
feat(coverage): option for raw V8 script coverage (#6454) 2021-09-15 18:54:24 +00:00
Xavier Prud'homme
caa2b732fe
fix(frame): fix Frame.waitFor's XPath pattern detection (#5184)
Up to now, only strings starting with '//' are considered as to XPath selectors. Unfortunately, this is too restricting. This fix allows valid XPath selectors starting with: '/', './', and even '(//*[1])'
2021-09-15 11:45:59 +00:00
Peter Marshall
726cb14003
chore: remove unused tracing category for cpu profiling (#5866) 2021-09-15 11:59:38 +02:00
Noam Lustiger
300be5d167
feat: add id option to addScriptTag (#5477) 2021-09-14 23:02:05 +02:00
Jan Scheffler
1d0fc459c8
chore: add comment to explain origin of test (#7398) 2021-09-14 16:56:09 +00:00
Paul Adams
af2b5fca12
chore: clarify error message when node is not clickable (#6949) 2021-09-14 16:38:58 +00:00
Li Wenyan
f90af6639d
feat: support timeout for page.pdf() call (#7508) 2021-09-14 16:11:14 +00:00
Tom Jenkinson
a21b7376e7
fix(test): tweak waitForNetworkIdle delay in test between downloads (#7564) 2021-09-14 14:46:53 +02:00
Albert Nigmatzianov
491614c7f8
fix(types): allow evaluate functions to take a readonly array as an argument (#7072) 2021-09-11 21:31:08 +00:00
Tom Jenkinson
3c6029c702
feat(api): implement Page.waitForNetworkIdle() (#5140)
which will wait for there to be no network requests in progress during the `idleTime` before resolving.
2021-09-11 22:28:12 +02:00
Jan Potoms
040a0e561b
fix: use non-deprecated tracing categories api (#7413) 2021-09-10 20:23:35 +00:00
Jan Scheffler
e10faad4f2
feat(chromium): roll to Chromium 93.0.4577.0 (r901912) (#7387) 2021-08-04 14:22:15 +02:00
Mathias Bynens
dd470c7a22
feat(api): make page.isDragInterceptionEnabled a method (#7419)
Having it be a getter is surprising and inconsistent, since the other `page.is*` APIs are just methods.

Issue: #7150
2021-07-13 11:37:39 +02:00
Yusuke Iwaki
d70f60e061
feat: add channel parameter for puppeteer.launch (#7389)
This change adds a new `channel` parameter to `puppeteer.launch`. When specified, Puppeteer will search for the locally installed release channel of Google Chrome and use it to launch. Available values are `chrome`, `chrome-beta`, `chrome-canary`, `chrome-dev`. This parameter is mutually exclusive with `executablePath`.
2021-07-09 12:43:42 +00:00
Ben Allfree
b5e6474374
feat: add cooperative request intercepts (#6735)
With this change,`request.respond`, `request.abort`, and `request.continue` can accept an optional `priority` to activate Cooperative Intercept Mode. In Cooperative Mode, all intercept handlers are guaranteed to run and all async handlers are awaited. The interception is resolved to the highest-priority resolution. See _Cooperative Intercept Mode and Legacy Intercept Mode_ in `docs/api.md` for details.
2021-07-02 17:58:32 +00:00
Rowan Merewood
7200b1a6fb
feat: add support for useragentdata (#7378)
Adds userAgentData to setUserAgent that supports specifying user agent
data for the new navigator.userAgentData and Client Hints headers.
2021-06-29 18:29:55 +02:00
Brian Misiak
e3699e248b
feat: add a streaming version for page.pdf
Co-authored-by: Jan Scheffler <janscheffler@chromium.org>
2021-06-23 14:51:38 +02:00
Jan Scheffler
4ce4110628
feat: add page.emulateCPUThrottling (#7343) 2021-06-22 11:43:11 +00:00
Dan Park
a91b8aca37 feat: add drag-and-drop support (#7150)
This commit adds drag-and-drop support, leveraging new additions to the CDP Input domain (Input.setInterceptDrags, Input.dispatchDragEvent, and Input.dragIntercepted).
2021-06-07 13:50:34 +02:00
Darío Kondratiuk
b4509d31cc
test: fix page.browserContext test title (#7292) 2021-05-27 13:51:41 +00:00
Darío Kondratiuk
ad523c87fa
test: move network emulation tests to the emulation spec file (#7293) 2021-05-27 13:17:12 +00:00
Jan Scheffler
f863f4bfe0
feat(chromium): roll to Chromium 92.0.4512.0 (r884014) (#7288) 2021-05-26 16:44:29 +00:00
Darío Kondratiuk
2c9ff4feaf
test: fix typo in page test (#7277) 2021-05-26 14:52:54 +00:00
Maksim Sadym
cb038cd401
test: close browser in case of test failed (#7271) 2021-05-26 11:17:56 +02:00
Darío Kondratiuk
89a85b428d
test: reorder describes in JS coverage spec (#7075)
Just some code reorder. We had a describe between it calls. I'm moving that describe to the end

Co-authored-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-25 08:14:44 +01:00
Robin Richtsfeld
d01aa6c84a
feat(requestinterception): remove cacheSafe flag (#7217) 2021-05-20 14:09:56 +02:00
Robin Richtsfeld
e0b35d7d1d
test: remove console.log in unit test (#7216)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-05-17 07:32:53 +00:00
Jack Franklin
4796382f01
chore: enforce pinned dependencies (#7238)
* chore: enforce pinned dependencies

Because we don't check our `package-lock.json` in, we can end up with
different versions installed locally vs CI, or even two devs having
different versions. Let's pin and enforce we pin every version to
avoid this.
2021-05-14 12:02:36 +01:00
Jack Franklin
3204f2780f
chore: fix eslint warnings around type defs (#7230)
This PR updates some code to remove constant ESLint warnings. It also
upgrades those warnings to errors - so that they have to be resolved
as part of the PR, rather than landing as a warning and causing noise.

Fixes #7229.
2021-05-12 17:43:05 +01:00
Jack Franklin
523aa0aafa
chore: upgrade and pin prettier dependencies (#7232)
We're seeing odd failures with Prettier on some CI branches; my hunch is that they are installing different versions of the package and therefore getting formatting conflicts. This PR updates them all and pins them to specific versions - something we should probably consider generally, or remove our `package-lock.json` from the gitignore.
2021-05-12 16:48:30 +02:00
Patrick Hulce
cb285a2379
feat: expose other sessions from connection (#6863) 2021-05-07 08:31:39 +00:00
Peng-Yu Chen
2605309f74
feat(launcher): add new launcher option waitForInitialPage (#7105)
The existing behavior is expected to be unchanged as the value defaults to true.
Adding such option would allow user to skip the initial wait.

Issue: #3630
2021-05-06 20:30:04 +00:00
Robin Richtsfeld
c9978d20d5
fix(requestinterception): fix font loading issue (#7060)
See https://github.com/puppeteer/puppeteer/pull/6996#issuecomment-811546501 and https://github.com/puppeteer/puppeteer/pull/6996#issuecomment-813797393 for context.

Issue: #7038
2021-05-06 08:36:34 +02:00
Jan Scheffler
8126101980
chore: disable flaky test on Firefox (#7207) 2021-05-05 12:21:14 +00:00
Jan Scheffler
ec3fc2e035
feat: add option to filter targets (#7192)
* feat: add option to filter targets

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-05-03 13:48:31 +02:00
Jan Scheffler
a293b96952 chore: disable flaky test on Firefox
Issue: #7182
2021-05-03 10:48:29 +02:00
Henrik Skupin
49a54cfc93
chore: enable firefox reconnection spec (#7114) 2021-04-22 09:55:49 +02:00
Henrik Skupin
4607d5a2d3
chore: run "should be able to launch Firefox" only with regular install (#7106) 2021-04-20 08:56:20 +02:00
Darío Kondratiuk
c39c81d016 test: fix Browser.pages should return all of the pages (#7064) 2021-04-07 09:11:43 +02:00
Darío Kondratiuk
138ddc3641
chore(test): reorder describes in coverage spec (#7032) 2021-04-06 09:30:55 +00:00
Alex Rudenko
4426135692
fix(aria): fix parsing of ARIA selectors (#7037) 2021-04-06 10:41:49 +02:00
Jack Franklin
9633e6e392
chore: disable firefox reconnection spec (#7062)
It's constantly failing on CQ - think there's an issue in Firefox
nightly.
2021-04-06 08:19:32 +00:00
Jack Franklin
b349c91e7d
fix: make $ and $$ selectors generic (#6883)
* fix: make `$` and `$$` selectors generic

This means, much like TS's in built `querySelector` type, you can now do:

```ts
const listItems = page.$$<HTMLLIElement>('ul li');
```

And/or:

```ts
const h2 = page.$<HTMLHeadingElement>('h2');
```

And the return value will be of type `ElementHandle<T>|null`, where `T`
is the type you provided. By default `T` is an `Element`, so you don't
have to provide this if you don't care as a consumer about the exact
type you get back.

* chore: fix test assertions
2021-03-25 11:40:34 +00:00
David Barton
c62b02f177
chore: automate prettier in docs (#7014)
Issue: #7012
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-03-23 10:02:34 +01:00
Julian Descottes
b8d72cb039
chore: skip non-standard cookie asserts on Firefox (#6994) 2021-03-17 16:09:10 +00:00
Robin Richtsfeld
8695759a22
feat(network): request interception and caching compatibility (#6996)
This patch enables developers to also keep the cache on when doing request interception.
2021-03-17 15:42:35 +01:00
Henrik Skupin
bf60a300e7
chore: improve "Page.close should run beforeunload if asked for" unit test for Firefox (#6995) 2021-03-16 15:35:32 +01:00
Robin Richtsfeld
1c2479a6cd
fix(network): don't disable cache for auth challenge (#6962)
* fix(network): don't disable cache for auth challenge

* test: page.authenticate does not disable caching

* fix(network): _protocolRequestInterceptionEnabled -> _userRequestInterceptionEnabled

* style(test): fix line breaks

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-03-15 07:02:07 +00:00
Henrik Skupin
669f04a7a6
chore: enable unit tests for Firefox on Windows (#6895)
Co-authored-by: Jan Scheffler <janscheffler@chromium.org>
2021-03-05 09:00:56 +00:00
Darío Kondratiuk
2ba61e04e9
fix(filechooser): cancel is sync (#6937)
BREAKING CHANGE: FileChooser.cancel() is now synchronous.
2021-03-02 15:27:11 +01:00
Alex Rudenko
0c688bd75e
feat(chromium): roll Chromium to r856583 (#6927)
* feat(chromium): roll Chromium to r856583

This corresponds to Chromium 90.0.4427.0

This roll includes:
- Add sourceScheme, sourcePort, and sameParty to DevTools backend (https://crbug.com/1170548, https://crbug.com/1142606)
2021-02-26 09:12:43 +01:00
Henrik Skupin
b046fd79bd
chore: run unit tests for Firefox on MacOS (#6896) 2021-02-18 13:44:36 +01:00
Jack Franklin
8adf5b467d
chore: upgrade TypeScript to 4.1.5 (#6889)
We were blocked on doing this because API Extractor didn't support it,
but now it does, so we can bump TS and the API tooling in one go. None
of the breaking changes in TS4 cause us any issues.
2021-02-16 10:43:32 +00:00
Jack Franklin
a5e174f696
fix: expose puppeteer.Permission type (#6856)
* fix: expose puppeteer.Permission type

A regression in our own types when compared to @types/puppeteer - we
needed to expose the permissons.
2021-02-11 15:44:56 +00:00
Alex Rudenko
ad5935738d
feat(page): add color-gamut support to Page.emulateMediaFeatures (#6857)
The change updates the validation function to allow color-gamut media
features and updates the documentation.

Issues: #6761
2021-02-11 13:59:50 +00:00
Mathias Bynens
a63f53c938
fix: add favicon test asset (#6868)
The favicon was taken from https://github.com/mathiasbynens/small.

Issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1682076
2021-02-11 11:54:45 +00:00
Jack Franklin
bdaba7829d
fix: jsonValue() type is generic (#6865)
During the migration to TS we changed `jsonValue` so it returned
`<Record<string, unknown>>`. This is only true if all the JSON values it
returns are objects; but it could return an array, a string, a number,
etc. Therefore we make the type generic, setting the default to
`unknown`, so the user has control over the type.
2021-02-11 09:50:15 +00:00
Jan Scheffler
4e8d074c2f
fix(domworld): reset bindings when context changes (#6766) (#6836) 2021-02-08 18:56:04 +00:00
Maksim Sadym
401d84e4a3
feat: use captureBeyondViewport in Page.captureScreenshot (#6805)
BREAKING CHANGE:
- `page.screenshot` makes a screenshot with the clip dimensions, not cutting it by the ViewPort size.
2021-02-03 14:30:46 +01:00
Maksim Sadym
890d5c2e57
feat(chromium): roll Chromium to r848005 (#6801)
This corresponds to Chromium 90.0.4403.0
This roll includes:
- Cut screenshot by ViewPort size, not position (crrev.com/c/2643792)

BREAKING CHANGE:
- `page.screenshot` cuts screenshot content by the ViewPort size, not ViewPort position.
2021-02-02 17:24:10 +01:00
Maksim Sadym
8f9fbdbae6 feat(chromium): roll Chromium to r843427 (#6797)
This corresponds to Chromium 89.0.4389.0.

This roll includes:

- Add `SameParty` attribute to cookies
  https://crrev.com/c/2598846
- Anchor `target=_blank` implies `rel=noopener`
  https://crrev.com/c/1630010
- Don’t expect ignored elements in the AXTree
  https://crrev.com/c/2505362

BREAKING CHANGE: The built-in `aria/` selector query handler doesn’t return ignored elements anymore.

Issue: #6758
2021-02-02 08:40:56 +01:00
Jan Scheffler
cac540be3a
fix(domworld): fix waitfor bindings (#6766) (#6775)
* fix(domworld): fix waitfor bindings (#6766)

Co-authored-by: Johan Bay <jobay@google.com>
2021-01-25 13:01:59 +01:00
Jan Scheffler
5ea76e9333
feat: add page.emulateNetworkConditions (#6759) 2021-01-21 10:00:57 +01:00
Maja Frydrychowicz
09fca442f7
chore: update test expectations per Mozilla’s sync-up with v5.5.0 (#6650)
This patch enables more tests for Firefox. These tests are enabled in Mozilla's CI for Firefox. The extra error handling here prevents hangs in the test harness in that environment.
2020-12-07 08:18:32 +01:00
dmitrysteblyuk
fb859115c0
fix: do not use old utility world (#6528)
Don’t use the old utility world, as it is being destroyed later when browser reconnects to the page.

Issue: #6527
2020-11-26 12:43:42 +01:00
Michael Kebede
b57f3fcd53
feat: support promise as return value for page.waitForResponse predicate (#6624)
Co-authored-by: Joni <josalmi@google.com>
2020-11-25 11:35:47 +01:00
Jack Franklin
659193a4f5
chore: mark launcher spec as failing on Windows (#6574)
We've pushed this date back a lot, let's make it permanent until we have
more time to investigate.
2020-11-03 10:11:29 +00:00