Commit Graph

1163 Commits

Author SHA1 Message Date
jrandolf
acbc59999b
fix: remove viewport conditions in waitForSelector (#9087)
This PR removes the viewport conditions in `waitForSelector`.

See discussion:
https://github.com/puppeteer/puppeteer/pull/8954#issuecomment-1272338883
2022-10-10 16:00:47 +02:00
jrandolf
87c08fd86a
fix!: remove puppeteer.devices in favor of KnownDevices (#9075)
This PR removes the deprecated `puppeteer.devices` in favor of a new
exported object `KnownDevices`. `devices` can also be exported, but has
been deprecated.
2022-10-10 15:30:12 +02:00
Alex Rudenko
04270a39ea
chore: update test expectations (#9088) 2022-10-10 15:24:46 +02:00
smithc
a032583b6c feat: add ability to collect JS code coverage at the function level (#9027) 2022-10-06 23:53:05 +02:00
jrandolf
41d0122b94 fix!: deprecate indirect network condition imports (#9074) 2022-10-06 23:52:58 +02:00
jrandolf
9f4f43a28b fix!: deprecate indirect error imports (#9072) 2022-10-06 23:52:51 +02:00
jrandolf
3675f168ef
chore: improve CI jobs (#9054)
This PR separates the installations tests from normal tests and changes
the matrices as follows:

- Installations tests on all platforms and the latest 3 node versions.
- Chrome tests are done on all platforms on the latest node version.
- Firefox tests are done only on linux on the latest node version.
2022-10-06 15:45:22 +02:00
jrandolf
416d56b033
chore: refactor utils (#9053)
This PR

- renames the `utils` folder to `tools` (follows internal practice),
- migrates the contents of `scripts` into `tools` and removes scripts.
2022-10-06 10:27:14 +02:00
Egor Andreyuk
8f6b2c9b7c
fix: waitForRequest works with async predicate (#9058) 2022-10-05 20:46:34 +02:00
jrandolf
f42336cf83
feat: separate puppeteer and puppeteer-core (#9023)
This PR moves the puppeteer source code into separate mono-repo packages:

- `puppeteer` and `puppeteer-core` are now separated into their own
packages.
- `puppeteer-core` has a new exports called `puppeteer-core/internal`
for internal usage.

Tests and various tools have been updated to accommodate the migration.
2022-10-05 14:17:03 +02:00
Alex Rudenko
022fbde85e
feat(chromium): roll to Chromium 107.0.5296.0 (r1045629) (#9039) 2022-10-05 08:13:43 +02:00
jrandolf
c0c7878adc
chore: initiate monorepo migration (#9022)
This PR starts the monorepo migrations as per
https://github.com/puppeteer/puppeteer/issues/8922. To scope migrations,
we are only moving the `testserver` into a separate package. Further
migrations will come later.
2022-09-29 10:08:55 +02:00
Alex Rudenko
023ebd8f78
chore: enable firefox tests on Mac (#9002) 2022-09-23 19:06:09 +02:00
Henrik Skupin
5a1b8d2d7c
chore: add headful support for Firefox (#9004)
* chore: add headful support for Firefox

* chore: update test expectation data for Firefox headful tests
2022-09-23 07:23:36 +02:00
Alex Rudenko
a6f4584a74
chore: clarify build instructions (#9000) 2022-09-22 14:53:06 +02:00
Alex Rudenko
31e7b608d5
chore: implement basic evaluate in BiDi (#8989)
Only the basic return values are supported.
The follow-up PRs will re-use the shared code
from the ExecutionContext and introduce Frame
in BiDi.
2022-09-21 08:10:50 +02:00
jrandolf
7efcb9ca3d
chore: remove unused code (#8977) 2022-09-19 12:48:14 +02:00
jrandolf
2a2af7134f
chore: incrementally erase cache on text change (#8961) 2022-09-15 18:48:55 +02:00
Alex Rudenko
fa084bcdcd
chore: extract CDPSession base class for easy mocking (#8950) 2022-09-15 13:50:12 +00:00
jrandolf
633e7cfdf9
feat: add text query handler (#8956) 2022-09-15 11:12:13 +00:00
jrandolf
ac9929d80f
fix!: fix bounding box visibility conditions (#8954) 2022-09-15 09:25:20 +02:00
jrandolf
7c4f41fadc
chore: use injections for wait tasks (#8943)
This PR refactors wait tasks to use injected scripts.
2022-09-15 08:22:20 +02:00
Alex Rudenko
8d5097d7f6
chore: split CI jobs to run in parallel (#8934) 2022-09-15 05:59:11 +00:00
Alex Rudenko
db28203e64 chore: support WebDriver BiDi browser instances (#8932)
This PR adds a basic support for WebDriver BiDi that currently includes only the ability to establish a connection and shutdown the browser. Therefore, the implementation is marked as internal and won't show up in the changelog as it's barely useful at the moment.

The API classes are kept as classes instead of interfaces so that clients relying on instanceof checks still work.
2022-09-15 02:15:15 +02:00
jrandolf
6fd05d963e
chore: use handle instead of globals for injection (#8946) 2022-09-13 14:06:40 +02:00
Alex Rudenko
504c7a1ae6
chore: implement custom mocha interface for the runner (#8929)
Instead of checking skipped tests in mocha-utils this PR
implements a custom mocha interface for better flexibility
when skipping tests. That should allow skipping tests without
running before and after hooks.
2022-09-09 11:12:18 +02:00
Alex Rudenko
d8830cbc55
chore: implement a test runner on top of mocha (#8866)
* chore: implement a test runner on top of mocha

This PR implements a test runner on top of mocha
that performs multiple mocha runs as defined in
TestSuites.json and compares the outcome of the runs
against TestExpectations.json. This allows us to
remove most of helpers from mocha-utils and be more
flexible when defining the test configurations.
2022-09-08 10:32:39 +00:00
Alex Rudenko
8b3caae8d1
chore: enable cookie restoration test (#8909)
Closes #4111
2022-09-07 09:42:06 +00:00
smithc
0c577b9bf8
fix: add missing code coverage ranges that span only a single character (#8911) 2022-09-07 07:10:07 +00:00
Alex Rudenko
260e428227
fix: support scale for screenshot clips (#8908)
Closes #5329
2022-09-07 05:27:40 +00:00
Alex Rudenko
a870c258bf
chore: update expectations for Firefox when evaluate fails (#8890) 2022-09-02 09:41:34 +00:00
jrandolf
6b4a99fcfa
chore: migrate addStyleTag (#8879)
* chore: remove unnecessary type signature

* chore: fix tests

* chore: migrate `addStyleTag`

* chore: fix tests

* chore: fix tests
2022-09-01 17:52:08 +02:00
jrandolf
8f11237a67
chore: migrate addScriptTag (#8878) 2022-09-01 17:09:57 +02:00
jrandolf
ae4c5ea031
chore: refactor build commands (#8874) 2022-09-01 01:05:20 +02:00
Alex Rudenko
61624d2695
chore: fix a flaky test in request interception (#8870) 2022-08-31 16:10:49 +02:00
Alex Rudenko
6e9a47a6fa
feat(chromium): roll to Chromium 106.0.5249.0 (r1036745) (#8869) 2022-08-31 15:27:59 +02:00
jrandolf
292216652b
chore: add injection framework (#8862)
* chore: add injection framework
2022-08-31 10:50:22 +02:00
jrandolf
b49e742e30
chore: make execution context frame-independent (#8845) 2022-08-25 17:38:02 +02:00
Alex Rudenko
2a0eefb99f
fix: handle service workers in extensions (#8807)
Closes #8800
2022-08-17 19:34:34 +02:00
jrandolf
51b2f0576d
chore: move Frame to Frame.ts (#8806) 2022-08-17 17:45:45 +02:00
jrandolf
bdcb748b98
chore: infrastructure for injecting scripts into DOMWorlds (#8801) 2022-08-17 14:39:41 +02:00
Alex Rudenko
3fad05d333
fix: custom sessions should not emit targetcreated events (#8788)
Closes #8787
2022-08-16 10:56:13 +00:00
jrandolf
ddbe88b887
chore: add custom rule for formatting comments (#8777) 2022-08-12 14:15:26 +02:00
Alex Rudenko
73221042db
chore: follow test:$browser[:$flavor] naming for tests + retries for Firefox (#8775) 2022-08-11 18:45:52 +00:00
jrandolf
a238f5758d
chore: refactor JSHandle and ExecutionContext (#8773) 2022-08-11 11:45:35 +02:00
Alex Rudenko
ee2540baef
fix: use targetFilter in puppeteer.launch (#8774)
Drive-by: adds Symbol.toStringTag to Target to simplify
debugging.

Closes #8772
2022-08-11 09:15:00 +00:00
Alex Rudenko
2580347b50
fix: resolve navigation flakiness (#8768)
Two main sources of flakiness addressed: 

1) we should dispose the lifecycle watcher after we waited for the navigation response (bad API? we need to refactor but I think it'd be valuable to stabilize tests first without too many changes).
2) we should wait for the navigation request's response if there is a navigation request in the watcher.

Closes #8644
2022-08-10 15:59:58 +00:00
Alex Rudenko
c23cdb73a7
fix: make sure there is a check for targets when timeout=0 (#8765)
Previously, if timeout is falsy, the targets would only
be checked if a browser-level event fires which lead to
a race: if the events arrived before waiting for a target,
the promise would never resolve.

Fixes #8763
2022-08-10 15:49:59 +02:00
Alex Rudenko
af78cc768f
chore: fix proxy-related tests (#8753) 2022-08-08 14:31:12 +00:00
Alex Rudenko
8cb5043868
fix: resolve target manager init if no existing targets detected (#8748)
Closes #8747
2022-08-06 15:35:42 +02:00
jrandolf
5cf9b4de8d
feat: use an xpath query handler (#8730) 2022-08-04 15:45:21 +02:00
Alex Rudenko
2abd772c9c feat: detect Firefox in connect() automatically (#8718)
This PR implements automatic detection of the Firefox product when the `.connect()` method is used. This partially undoes the breaking change in https://github.com/puppeteer/puppeteer/pull/8520 but it's also a breaking change on its own since we don't accept an explicit product name anymore (it does not look like it was used anyway).
2022-08-02 13:18:51 +00:00
Alex Rudenko
6f81b23728 fix: address flakiness in frame handling (#8688)
When we attach to a frame, we send a call to get
the page frame tree from CDP. Based on the tree data
we look up the parent frame if parentId is provided.
The problem is that the call to get the page frame
tree could take arbitrary time and the calls for the
parent and child frames might happen at the same time.
So the situation where the frame tree for the child frame
is resolved before the parent frame is known is fairly
common.

This PR addresses the issue by awaiting for the parent
frame id before attempting to register a child frame.
2022-08-02 13:18:47 +00:00
Alex Rudenko
2cbfdeb0ca feat: use CDP's auto-attach mechanism (#8520)
* feat: use CDP's auto-attach mechanism

In this PR, we refactor Puppeteer to make use of the CDP's auto-attach mechanism. This allows the backend to pause
new targets and give Puppeteer a chance to configure them properly. This fixes the flakiness related to dealing with
OOPIFs and should fix some other issues related to the network interception and navigations. If those are not fixed completely by this PR, the PR serves a solid base for fixing them.

Closes https://github.com/puppeteer/puppeteer/issues/8507, https://github.com/puppeteer/puppeteer/issues/7990
Unlocks https://github.com/puppeteer/puppeteer/issues/3667

BREAKING CHANGE: With Chromium, Puppeteer will now attach to page/iframe targets immediately to allow reliable configuration of targets.
2022-08-02 13:18:07 +00:00
Alex Rudenko
2abb9f0c14
fix: taking a screenshot with null viewport should be possible (#8680)
Closes #8673
2022-07-21 10:34:18 +02:00
Alex Rudenko
af08c5c903
feat: expose the page getter on Frame (#8657)
* feat: expose the page getter on Frame

Closes #8654

* test: add a test
2022-07-11 21:06:35 +02:00
Asen Bozhilov
b47f066c2c
fix(page): fix page.#scrollIntoViewIfNeeded method (#8631)
This patch fixes page.#scrollIntoViewIfNeeded, so that it works with devtools protocol.
Now it blocks the main thread and waits until the scrolling action finishes in Chrome.
Fallbacks to the old implementation if `DOM.scrollIntoViewIfNeeded` is not supported for Firefox.

Issues: #8627, #1805
2022-07-08 06:53:45 +00:00
Alex Rudenko
d0c4291995
fix: expose a RemoteObject getter (#8642)
Closes #8639
2022-07-07 13:04:28 +00:00
jrandolf
5ff205dc8b
fix: extends ElementHandle to Nodes (#8552)
* fix: extends `ElementHandle` to `Node`s (#8552)
2022-07-06 09:05:37 +02:00
jrandolf
28e236f1a6
chore: use --parallel (#8612) 2022-07-05 14:42:55 +02:00
jrandolf
32c9f3e6fb
chore: update contributing.md (#8616) 2022-07-01 16:29:21 +02:00
jrandolf
066f440ba7
feat: add documentation (#8593) 2022-07-01 11:52:39 +00:00
Levi Pesin
79e11985ba
feat: add fromSurface option to page.screenshot (#8496) 2022-06-27 12:37:37 +00:00
Alex Rudenko
329195011f
chore: fix chrome-headless ci (#8560) 2022-06-27 12:35:09 +02:00
jrandolf
7001322cd1
feat: export public types only (#8584) 2022-06-27 09:24:23 +02:00
Pablo Matías Gomez
9787a1d8df
fix: clean up tmp profile dirs when browser is closed (#8580)
* fix: clean up tmp profile dirs when browser is closed
2022-06-27 07:40:30 +02:00
Alex Rudenko
fb7d31e369
feat(chromium): roll to Chromium 104.0.5109.0 (r1011831) (#8569)
* feat(chromium): roll to Chromium 104.0.5109.0 (r1011831)

* test: update a11y test expectations
2022-06-24 14:13:31 +00:00
Alex Rudenko
383e855847
fix: CSS coverage should work with empty stylesheets (#8570)
Closes #8535
2022-06-24 14:17:16 +02:00
jrandolf
8100cbb295
fix: infer unioned handles (#8562) 2022-06-24 06:40:08 +00:00
jrandolf
ebcb8a2760
chore: split JSHandle.ts (#8551) 2022-06-23 11:31:43 +02:00
jrandolf
26c3acbb07
feat!: type inference for evaluation types (#8547)
This PR greatly improves the types within Puppeteer:

- **Almost everything** is auto-deduced.
  - Parameters don't need to be specified in the function. They are deduced from the spread.
  - Return types don't need to be specified. They are deduced from the function. (More on this below)
  - Selections based on tag names correctly deduce element type, similar to TypeScript's mechanism for `getElementByTagName`.
- [**BREAKING CHANGE**] We've removed the ability to declare return types in type arguments for the following reasons:
  1. Setting them will indubitably break auto-deduction.
  2. You can just use `as ...` in TypeScript to coerce the correct type (given it makes sense).
- [**BREAKING CHANGE**] `waitFor` is officially gone.

To migrate to these changes, there are only four things you may need to change:
- If you set a return type using the `ReturnType` type parameter, remove it and use `as ...` and `HandleFor` (if necessary).
 `evaluate<ReturnType>(a: number, b: number) => {...}, a, b)`
 `(await evaluate(a, b) => {...}, a, b)) as ReturnType`
 `evaluateHandle<ReturnType>(a: number, b: number) => {...}, a, b)`
 `(await evaluateHandle(a, b) => {...}, a, b)) as HandleFor<ReturnType>`
- If you set any type parameters in the *parameters* of an evaluation function, remove them.  
 `evaluate(a: number, b: number) => {...}, a, b)`
 `evaluate(a, b) => {...}, a, b)`
- If you set any type parameters in the method's declaration, remove them.
 `evaluate<(a: number, b: number) => void>((a, b) => {...}, a, b)`
 `evaluate(a, b) => {...}, a, b)`
2022-06-23 11:29:46 +02:00
jrandolf
347101883f
chore: split Launcher.ts (#8544) 2022-06-23 00:13:39 +02:00
jrandolf
84712cbc28
chore: use Google's TS style guide's format config (#8542) 2022-06-22 15:25:44 +02:00
jrandolf
ce0dd25349
chore: use braces in function bodies (#8525) 2022-06-15 12:42:21 +02:00
jrandolf
570087ea94
chore: use strict typing in tests (#8524)
* The testing tsconfig.json inherits from the base TS config.
  * A lot of type assertions have been inserted...a lot.
* All testing utilities have migrated to TS.
* text-diff is being replaced with diff for TS compatibility.
* ProtocolError has been added to PuppeteerErrors and PuppeteerErrors is no longer a record (it's been frozen).
* Fixes a small bug where null was an allowable media type in emulation (should be undefined).
2022-06-15 12:09:22 +02:00
jrandolf
80373f7a12
chore: use composite builds for tests (#8522) 2022-06-15 12:05:25 +02:00
jrandolf
e6442dd767
chore: use curly (#8519) 2022-06-14 13:55:35 +02:00
jrandolf
0678343b53
chore: move helper.js to util.js (#8510) 2022-06-14 13:16:21 +02:00
jrandolf
6c960115a3
chore: use private fields (#8506) 2022-06-13 11:16:25 +02:00
jrandolf
733cbecf48
chore: use c8 coverage (#8495) 2022-06-10 18:49:14 +02:00
jrandolf
4d359906a4
fix: use error-like (#8504) 2022-06-10 15:27:42 +02:00
Alex Rudenko
58ff348b76
chore: skip an oopif test for headful and chrome headless (#8501) 2022-06-10 12:39:18 +02:00
jrandolf
75c3f94a54
chore: namespace commands (#8494) 2022-06-10 11:55:53 +02:00
jrandolf
465a7c405f
feat: export puppeteer methods (#8493) 2022-06-09 19:00:50 +02:00
jrandolf
b30f3f44cd
fix: parse empty options in <select> (#8489) 2022-06-09 13:27:34 +02:00
jrandolf
e8378666c6
fix: don't throw on bad access (#8472) 2022-06-07 16:17:21 +02:00
Alex Rudenko
5c9050aea0
fix: use isPageTargetCallback in Browser::pages() (#8460) 2022-06-02 13:27:31 +02:00
jrandolf
30438e6532
chore: use ts-doc and factor out importFSModule (#8449) 2022-06-01 11:11:09 +02:00
jrandolf
b4e751f29c
feat: use strict typescript (#8401) 2022-05-31 16:34:16 +02:00
Junyan
92110151d9
fix: multiple same request event listener (#8404) 2022-05-30 20:34:08 +00:00
Julian Descottes
f866274360
chore: enable anchor navigation tests for Firefox (#8394) 2022-05-25 06:46:17 +00:00
Alex Rudenko
f657233ca4
test: skip dumpio test in non-headless modes (#8388) 2022-05-24 11:50:49 +00:00
Alex Rudenko
ea47ff0766
chore: fix failing test for the chrome headless (#8364) 2022-05-19 07:41:29 +00:00
jrandolf
74380303ac
fix: only check loading iframe in lifecycling (#8348) 2022-05-17 12:15:44 +00:00
Alex Rudenko
24dfbd5f7f
chore: remove console.log from test (#8351) 2022-05-16 10:04:57 +02:00
Alex Rudenko
3b66a2c47e
feat: allow handling other targets as pages internally (#8336)
Co-authored-by: jrandolf <101637635+jrandolf@users.noreply.github.com>
2022-05-13 08:04:46 +02:00
Alex Rudenko
0ae8936f5e
chore: disable failing permission test (#8337) 2022-05-12 20:09:23 +02:00
Pirikara
a61144d437
fix: If currentNode and root are the same, do not include them in the result (#8332)
* fix: If currentNode and root are the same, do not include them in the result

* fix: Tests that only child element is included in the result

Co-authored-by: jrandolf <101637635+jrandolf@users.noreply.github.com>
2022-05-11 12:17:02 +00:00
Alex Rudenko
7eaadafe19
feat: add waitForXPath to ElementHandle (#8329) 2022-05-10 12:45:20 +02:00
Alex Rudenko
553959884f
fix: make sure inner OOPIFs can be attached to (#8304) 2022-05-04 07:46:38 +02:00
Alex Rudenko
e841d7f9f3
fix: tests failing in headful (#8273)
* fix: test failing in headful

* fix: install Firefox for headful tests

* fix: skip favicon.ico requests in test

* fix: auth test in headful

* fix: disable NetworkTimeServiceQuerying

* fix: filter more favicon requests

* fix: network test with favicon

* fix: improve fixes
2022-05-02 11:37:21 +02:00
Darío Kondratiuk
f39eb70f2f
test: run Frame.evaluate tests on Firefox (#8296) 2022-05-02 08:21:19 +02:00
Darío Kondratiuk
25d363bf9c
test: move async predicate to waitForResponse describe (#8285) 2022-04-28 14:51:57 +00:00
jrandolf
7a51bff47f
feat: add back and forward mouse buttons (#8284) 2022-04-27 21:00:07 +00:00
Alex Rudenko
912dfbaf48
test: disable a failing Firefox test (#8286) 2022-04-27 17:34:53 +02:00
Alex Rudenko
1308d9aa6a
feat: support chrome headless mode (#8260)
* feat: support chrome headless mode

Co-authored-by: Ergün Erdoğmuş <erdogmusergun@gmail.com>
2022-04-25 13:11:23 +02:00
Henrik Skupin
c6cf1a9f27 fix: use different test names for browser specific tests in launcher.spec.ts (#8250) 2022-04-20 12:09:40 +02:00
Matheus Marabesi
e93faadc21
fix(network.spec.ts): typo in the word should (#8223) 2022-04-19 13:24:53 +00:00
Henrik Skupin
b6504d7186
fix: also kill Firefox when temporary profile is used (#8233)
* fix: also kill Firefox when temporary profile is used

* fix: use separate tests for Puppeteer.launch should filter out ignored default arguments
2022-04-19 12:09:23 +00:00
Joel Baranick
91a8e73b11
fix: forget queuedEventGroup when emitting response in responseReceivedExtraInfo (#8234) (#8239) 2022-04-19 09:28:44 +00:00
Julian Descottes
2b45027d25
fix: enable page.spec event handler test for firefox (#8214) 2022-04-08 13:01:03 +00:00
Julian Descottes
04e5c88997
fix: ignore favicon requests in page.spec event handler tests (#8208) 2022-04-07 16:06:12 +00:00
Alex Rudenko
0955225b51
fix: consider existing frames when waiting for a frame (#8200) 2022-04-07 15:05:36 +02:00
Junyan
c1dcd857e3
feat: respond multiple headers with same key (#8183) 2022-04-05 09:06:35 +00:00
Junyan
37ede68770
fix: get extra headers from Fetch.requestPaused event (#8162) 2022-03-28 07:54:24 +00:00
Alex Rudenko
34775e5831
fix: waitForNavigation in OOPIFs (#8117) 2022-03-09 12:24:17 +01:00
James Diefenderfer
3feca325a9
fix: Inherit browser-level proxy settings from incognito context (#7770)
* chore: add request proxy tests

* fix: inherit browser-level proxy settings from incognito context

* fix: skip test on Windows
2022-03-07 10:12:26 +00:00
Matheus Marabesi
9ca57f190c
chore(network): avoid using if/else inside test case (#8095) 2022-03-04 07:50:09 +01:00
Martina Ferrari
3b8b9adde5
fix(tests): ensure all tests honour BINARY envvar (#8092)
Without this patch, two tests ignore the BINARY envvar, and fail when not using
the embedded chromium, unless the chromium executable path is defined via
PUPPETEER_EXECUTABLE_PATH, which should not be considered according to the
docs.
2022-03-03 14:05:49 +00:00
Alex Rudenko
85decdc28d
fix: regression in --user-data-dir handling (#8060) 2022-02-23 19:21:17 +00:00
jrandolf
e9278fcfcf
feat: export Frame._client through getter (#8041)
Co-authored-by: Randolf Jung <jrandolf@chromium.org>
2022-02-21 14:58:37 +00:00
Tmk
dbf0639822
feat: add support for async waitForTarget (#7885)
* feat: add support for async waitForTarget

* fix: add timeout

* fix: potential async bugs
2022-02-18 12:05:29 +01:00
Michael Mok
5c308b0704
fix: ensure dom binding is not called after detach (#8024)
* fix: ensure dom binding is not called after detatch

Fixes #7814

* refactor: detach listeners instead

* refactor: safer approach

* fix: test in test/page.spec.ts

Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
2022-02-17 15:52:51 +00:00
omjadas
30b3d49b0d
feat(HTTPResponse): expose timing information (#8025) 2022-02-15 11:16:49 +01:00
Nick Schonning
b2bf70fc3b
chore: update prettier globs and format files (#7856)
* chore: update prettier globs and format files

* fix: remove reference to Markdownlint
2022-02-11 20:29:43 +01:00
Josh Bielick
6d6ea9bf59
fix: always use ENV executable path when present (#7985)
Some recent changes to allow arm64 environments (including M1 macs) to
launch a chromium installation successfully before arm-compatible builds
were downloadable prevented the usage of PUPPETEER_EXECUTABLE_PATH in
some environments. Currently, when the platform is not darwin and the
arch is arm64, an executable cannot be specified using the environment
variable.

Generally speaking, environment variables have highest precedence for
options such as this since they depend on system configuration.

These change:

1. allow the ENV variable to always be used when defined and not
   specified in LaunchOptions (and when not puppeteer-core)
2. Retain the existing behavior of assuming /usr/bin/chromium-browser on
   platforms like Ubuntu (exact if-conditions preserved to avoid any
   breaking changes)
3. Add some tests for this particular portion of the code.
2022-02-11 13:07:31 +00:00
jrandolf
8ff9d598bf
chore(deps): update deps
Signed-off-by: Randolf Jung <jrandolf@chromium.org>

Co-authored-by: Randolf Jung <jrandolf@chromium.org>
2022-02-09 14:49:25 +00:00
jrandolf
96c3f943b2
feat(chromium): roll to Chromium 99.0.4844.16 (r961656) (#7960)
Co-authored-by: Randolf Jung <jrandolf@chromium.org>
2022-02-04 12:18:53 +01:00
Alex Rudenko
a55c86fac5
feat(chromium): roll to Chromium 98.0.4758.0 (r950341) (#7907) 2022-01-17 13:40:38 +00:00
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