Commit Graph

368 Commits

Author SHA1 Message Date
Alex Rudenko
bbb186d88c
fix: use require.resolve instead of __dirname (#8003) 2022-02-14 10:03:45 +00: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
Alex Rudenko
179ededa14
revert: esm modules (#7996)
* Revert "fix(puppeteer): export internals (#7991)"

This reverts commit 448118cbdb.

* Revert "feat(puppeteer): export esm modules in package.json (#7964)"

This reverts commit 523b487e88.
2022-02-10 13:34:36 +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
523b487e88
feat(puppeteer): export esm modules in package.json (#7964)
* feat(puppeteer): export esm modules in package.json

Signed-off-by: Randolf Jung <jrandolf@chromium.org>

Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
Co-authored-by: Randolf Jung <jrandolf@chromium.org>
2022-02-09 07:47:27 +00:00
Alex Rudenko
41ab4e9127
fix: typos in documentation (#7968) 2022-02-07 14:03:54 +01:00
Alex Rudenko
9afdc6300b
fix: make projectRoot optional in Puppeteer and launchers (#7967) 2022-02-07 12:59:44 +01: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
nswbmw
6a655cb647
feat: add more models to DeviceDescriptors (#7904) 2022-02-02 18:40:54 +01:00
Alex Rudenko
aaac8d9c44
fix: migrate more files to strict-mode TypeScript (#7950) 2022-01-31 15:16:32 +00:00
Alex Rudenko
0636513e34
fix: make more files work in strict-mode TypeScript (#7936) 2022-01-28 09:38:36 +00:00
Alex Rudenko
000c1f630d
chore: add TODO to use size parameter in getReadableFromProtocolStream (#7930) 2022-01-28 09:38:14 +01:00
tjacobs3
afea509544
fix: page.pdf producing an invalid pdf (#7868)
When defining a chunk size for <CDPSession>.send('IO.read', { handle, size }), the CDPSession will occasionally indicate that it has reached the end of file without sending a full pdf. This is documented by the associated issue.

This behavior is not reproducible when leaving out the size parameter. Since the size parameter is not required on the CDPSession side and is merely a suggestion on the stream side, we can safely leave it out.

Issues: #7757
2022-01-26 12:30:03 +00:00
Alex Rudenko
d80d6027ea fix: types in Connection.ts to be compatible with strict mode Typescript (#7919)
Issues: #6769
2022-01-21 12:41:21 +01:00
Alex Rudenko
a8ec0aadc9
fix: types in Browser.ts to be compatible with strict mode Typescript (#7918)
Issues: #6769
2022-01-20 14:15:23 +01:00
Alex Rudenko
344feb53c2
fix: use content box for OOPIF offset calculations (#7911)
If an iframe has a border, it has to be added to the offsets
too. We can work around it by using the content box coordinates
for the offsets. That should also prevent discrepancies if the
iframe has a padding set.
2022-01-18 09:22:15 +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
Johan Bay
02c9af62d6
fix(types): revert "feat(typescript): allow using puppeteer without dom lib"
Reverts #6998

We unfortunately have to revert this commit for two reasons:

The approach for generating types.d.ts implemented in the commit invalidates triple-slash compiler directives since it prepends a declaration before the types.d.ts generated by api-extractor.
In particular, the directive /// <reference types="node" /> in the final types.d.ts is ignored by the typescript compiler making module resolution fail.
The commit makes Puppeteer types ship without DOM types per default. This is not ideal since Puppeteer (and usage of Puppeteer) relies heavily on interacting with DOM elements.
2021-12-10 09:02:28 +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
Ben Allfree
71cc1b9591
refactor: remove unused promise (#7830) 2021-12-09 15:35:23 +01: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
Alex Rudenko
a604646f44
refactor: disallow direct access to attributes in NetworkEventManager (#7826) 2021-12-09 10:02:24 +00:00
Ben Allfree
bbfad6802c
refactor: extract NetworkEventManager from NetworkManager 2021-12-07 15:08:45 +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
6ee2feb1ea
fix: handle extraInfo events even if event.hasExtraInfo === false (#7808)
Issues: #7805
2021-11-29 20:46:02 +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
Connor Clark
9f9b4ed72a
fix: clearer jsdoc for behavior of headless when devtools is true (#7748)
The existing comment suggests that only the default changes–however, even if you set `devtools: false` and `headless: true`, Puppeteer will still open with headful.
2021-11-16 21:31:24 +01:00
Alex Rudenko
23ee295f34
fix: null check for frame in FrameManager (#7773)
Issues: #7749
2021-11-15 13:33:45 +00:00
Henrik Skupin
fc94a28778
fix: try to remove the temporary user data directory after the process has been killed (#7761) 2021-11-15 11:52:09 +00:00
Henrik Skupin
51e61696c1
fix: only kill the process when there is no browser instance available (#7762)
When the browser has been started and we have a valid reference lets make use of it instead of force-killing the process. A force kill should probably be the last resort in cleaning up the process.

This will help with Firefox as described on #7668 (comment).
2021-11-11 09:19:23 +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
5b792de7a9
fix: prevent Target closed errors on streams (#7728)
This change prevents Target closed errors when reading streams which were caused by ending the stream before IO.close returns.
2021-10-27 13:49:27 +00: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
Christopher Patty
b8806d5625
Adds default flag to export tagged PDFs in anticipation of Chrome 81 (#5337)
Co-authored-by: Jan Scheffler <janscheffler@chromium.org>
2021-10-12 14:07:18 +00:00
Henrik Skupin
5c592913a8
chore: ignore stdout when dumpio isn't used (#7644)
When the browser child process has logging enabled
and output on stdout isn't constantly processed,
the brower process is about to freeze.

To avoid such a situation at least the stdout
pipe shouldn't be set by default but only if
dumpio is enabled.

Co-authored-by: Jan Scheffler <janscheffler@chromium.org>
2021-10-07 21:43:57 +00:00
Tomas Junnonen
b20c2bfa24
fix: add webp to screenshot quality option allow list (#7631)
This allows passing through the screenshot quality option from Puppeteer to Chrome
when using the WebP image format
2021-10-07 21:15:24 +00:00
Jan Scheffler
2d37430838
chore: update types for JSHandle (#7650)
Closes #7583
2021-10-07 16:04:08 +00:00
Henrik Skupin
e7f82626ca
chore: disable certain Fission features for Firefox (#7610) 2021-10-07 12:13:54 +02:00
Darío Kondratiuk
51229c12f1
docs(page): add missing docs to emulateCPUThrottling (#7630)
The text was taken from the protocol.
2021-10-05 07:49:30 +00:00