Commit Graph

1976 Commits

Author SHA1 Message Date
Jack Franklin
4846b8723c
chore(agnostification): split up launcher class (#6484)
The `Launcher` class was serving two purposes:

1. Launch browsers
2. Connect to browsers

Number 1) only needs to be done in Node land, but 2) is agnostic; in a
browser version of Puppeteer we'll need the ability to connect over a
websocket to send commands back and forth.

As part of the agnostification work we needed to split the `Launcher` up
so that the connection part can be made agnostic. Additionally, I
removed dependencies on `https`, `http` and `URL` from Node, instead
leaning on fetch (via `node-fetch` if in Node land) and the browser
`URL` API (which was added to Node in Node 10).
2020-10-12 10:08:57 +01:00
Tim van der Lippe
1ed38af79a
chore(node): move install.ts into node/ (#6490)
This file contains logic that is unique to the Node.js environment and therefore should be moved into the `node` sub-folder.
2020-10-12 08:56:29 +02:00
Jack Franklin
e94a1e87dc
chore: bump misc dependencies (#6488)
This commit updates some miscellaneous dependencies to their latest
versions (with no other changes required) and also removes the `browser`
section, which was used by Browserify for the now long gone
Puppeteer-Web package that we used to publish.
2020-10-08 16:02:37 +01:00
Mathias Bynens
936ccdca2c
chore: enforce Conventional Commits through commitlint (#6483)
This patch sets up commitlint to enforce the Conventional Commits format. This check runs with the other lint checks as part of npm run lint, and a Git commit hook is set up via Husky for automated local checks.

Issue: #6482
2020-10-08 12:04:15 +02:00
Jack Franklin
502ed8c84c
chore(agnostify): Create Node and Web initializer. (#6477)
* chore(agnostify): Create Node and Web initializer.

This PR splits `initialize.ts` into two files, one for web, and one for
Node. The Node initializer requires much more information as it needs to
know which browser(s) to download and where to store them, whereas the
web one does not.

A future PR that I'm working on will tidy up `src/common/Puppeteer.ts`
(as it contains a lot of Node specific logic around downloading and
installing browsers), but this change enables us to stop the browser
bundle attempting to use the `pkg-dir` dependency, which wouldn't work
within a browser, as well as keeping the size of the PRs down and
avoiding one mammoth PR.
2020-10-07 14:48:01 +01:00
Johan Bay
3afe1935da
feat(a11y-query): extend aria handler with waitFor (#6472)
This commit adds waitFor to the built-in aria handler (#6307).
2020-10-07 10:49:11 +02:00
Johan Bay
cc7f1fd063
docs(queryhandler): add custom query handler docs (#6476) 2020-10-07 10:43:46 +02:00
Johan Bay
70ed875158
fix(queryhandler) only expose custom handlers (#6475)
This commit changes the custom query handler API to only operate on user-defined query handlers.
2020-10-07 10:15:54 +02:00
Johan Bay
950ae334ca
feat(a11y-query): aria query handler sans waitfor (#6459)
This commit adds a new built-in handler for querying by accessible name and role (#6307).
Support for waitForSelector will be added in a follow-up commit.
2020-10-05 08:25:55 +02:00
Maja Frydrychowicz
41ef3eec90
fix: update preferences in default Firefox profile (#6465) 2020-10-05 07:17:21 +02:00
Thomas Chaplin
9275653130
docs(examples): update selector for search example (#6471)
This commit updates the selector used in some examples as it no longer matched the target page’s DOM.

Fixes #6470, fixes #5071.
2020-10-05 06:48:34 +02:00
Johan Bay
49f25e2412
feat(chromium) roll Chromium to r809590 (#6458)
This corresponds to Chromium 87.0.4272.0
This roll includes:
- Reland "idle-detection: Implement requestPermission() method"
  (crrev.com/c/2417779)
2020-10-01 08:24:47 +02:00
Maja Frydrychowicz
4cdbebe1ac
chore: disable firefox windows launcher test until Nov (#6451) 2020-09-29 16:04:07 +01:00
Vse Mozhe Buty
75e3fb035b
docs(api): fix some outdated links (#6450) 2020-09-28 18:26:08 +02:00
Jack Franklin
caa9a1cafa
chore(agnostic): Remove use of util.promisify (#6446)
In `src/common` we now use `fs.promises.X` which we can dynamically
`import`. In a browser environment this code will never run because it's
gated on `isNode` (in a future PR we will add tree-shaking to the bundle
step such that this code is eliminated). By using `import`, we ensure
TypeScript still can track types and give good type information.

In `src/node` we continue to use `util.promisify` but that's not a
concern as that code explicitly is never run in the browser.
2020-09-28 10:35:35 +01:00
Yang Guo
96f3d439f5
feat(console): expose stack trace for console messages (#6445) 2020-09-25 15:27:13 +02:00
Jack Franklin
322cc96e7b
chore: remove npm run test-types call (#6447)
It was an old script that doesn't exist any more.
2020-09-25 12:44:34 +02:00
Johan Bay
72fe86fe6a
feat(a11y-query): introduce internal handlers (#6437)
This commit changes the internal representation of query handlers to contain Puppeteer-level code instead of page functions.
The interface `CustomQueryHandler` is introduced for user-defined query handlers. When a `CustomQueryHandler` is registered using  `registerCustomQueryHandler` a corresponding Puppeteer-level handler is created through `makeQueryHandler` by wrapping the page functions as appropriate.
The internal query handlers (defined by the interface `QueryHandler`) contain two new functions: `waitFor` and `queryAllArray`.
- `waitFor` allows page-based handlers to make use of the `WaitTask`-backed implementation in `DOMWorld`, whereas purely Puppeteer-based handlers can define an alternative approach instead.
- `queryAllArray` is similar to `queryAll` but with a slightly different interface; it returns a `JSHandle` to an array with the results as opposed to an array of `ElementHandle`. It is used by `$$eval`. 

After this change, we can introduce built-in query handlers that are not executed in the page context (#6307).
2020-09-23 16:02:22 +02:00
Maksim Sadym
1396c9d4cd
chore: bump version to v5.3.1-post (#6440) 2020-09-23 11:28:08 +02:00
Maksim Sadym
11ab402846
fix: add mime dependency back to fix build (#6441)
* Added back dependency `"mime": "^2.0.3",` to fix build;
* Previous builds passed because of the node package caching.
2020-09-23 09:56:40 +02:00
Maksim Sadym
c7d32cb92f
chore: mark version v5.3.1 (#6439) 2020-09-22 12:49:28 +02:00
Maksim Sadym
8f3171a33c
feat(permissions): Add idle-detection permission (#6438)
Added `idle-detection` permission needed to test IdleDetector:
* [CL 2417779 idle-detection: Implement requestPermission() method](https://chromium-review.googlesource.com/c/chromium/src/+/2417779)
2020-09-22 10:55:31 +02:00
Johan Bay
b1c3efaa34
feat(a11y-query): split waitFor logic for selectors and xpath (#6426)
The logic for waitForXPath and waitForSelector is currently very tightly coupled. This commit tries to untangle that relationship. This is the first step towards introducing built-in query handlers that are not executed in the page context (#6307).
2020-09-21 15:47:33 +02:00
Maksim Sadym
6f336eb978
feat(OOPIF): debug message in case of iFrame moved to another process (#6432)
Debug message clarifying the problem like `Issue 1060080: Event Network.loadingFinished is not sent when a frame is loaded from another domain`: https://bugs.chromium.org/p/chromium/issues/detail?id=1060080).
It can help users to identify problem with OOPIF easier without digging into the CDP protocol implementation like in the bug `1060080` mentioned above.

To reproduce:
1. Run `DEBUG="puppeteer:frame" NODE_PATH=../ node examples/oopif.js`.
2. Verify the output contains the debug message:
`
puppeteer:frame The frame '...' moved to another session. Out-of-proccess
iframes (OOPIF) are not supported by Puppeteer yet.
https://github.com/puppeteer/puppeteer/issues/2548
`
2020-09-21 13:23:36 +02:00
campersau
083ea41e94
test(frame): correct terminology in URL fragment test (#6416)
Bug: #6398
2020-09-14 13:42:32 +02:00
Mathias Bynens
bb1c5215a8
chore: remove mime dependency (#6415)
Bug: #5026, #6125
2020-09-14 13:39:33 +02:00
Maksim Sadym
17960e5d8d
feat(page): emulate idle state (#6410)
* https://bugs.chromium.org/p/chromium/issues/detail?id=1090802
* added `page.emulateIdleState(...)` allowing emulate or remove emulation of the idle state;
* added test `emulate idle` -> `remove emulation` -> `emulate idle` -> `remove emulation`;
* added launch argument `--enable-blink-features=IdleDetection` to turn IdleDetection on.
2020-09-14 11:31:23 +02:00
Maksim Sadym
03e41da465
chore: bump version to v5.3.0-post (#6413) 2020-09-14 10:17:05 +02:00
Maksim Sadym
030fcaa075
chore: mark version v5.3.0 (#6412) 2020-09-11 10:43:09 +02:00
Maksim Sadym
4ce600a6f4
chore: Remove target debug-unit and add unit-debug (#6411)
* debug-unit is confusing
* unit-debug runs all tests in debug mode
2020-09-11 10:10:25 +02:00
Maksim Sadym
62ac167339
feat(chromium): roll Chromium to r800071 (#6407)
* roll Chromium to version 86, r800071
* roll Chrome DevTools protocol version to 0.0.799653
* fix HTTPRequest.continue after
  * CDP: accept post data in the binary form in Fetch.continueRequest.
    https://chromium-review.googlesource.com/c/chromium/src/+/2315239
* update new-docs
2020-09-09 21:23:46 +02:00
Prashant Ghimire
35cfbe1857
docs(troubleshooting.md): updated commands (#6296)
prior command installs stable version of chrome (RUN command), but after that, the docs is referring to unstable version.
added correct commands for troubleshooting in linux environment.
2020-09-09 14:39:32 +01:00
Mathias Bynens
ce6ae3537e
doc(contributing): add info on bisecting upstream changes (#6402)
Co-authored-by: Johan Bay <jobay@google.com>
2020-09-08 15:19:37 +02:00
Mathias Bynens
e22ca4c7c4
chore: extend Firefox launch test deadline by a month (#6403)
Ref. #5673.
2020-09-08 15:08:23 +02:00
Johan Bay
2470d1e9cc
chore: update documentation on rolling chromium (#6399)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-09-08 11:05:51 +02:00
Bryan Maloyer
b6bbfd0ede
fix: ensure frame.url() includes the query string (#6398)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-09-08 10:49:44 +02:00
Johan Bay
7b24e5435b
fix: revise interesting classification for AXNodes (#6334) 2020-08-14 14:18:46 +02:00
lcabral37
13ea347c7d
feat: support configuring the browser download path (#6014)
By adding support for an environment variable `PUPPETEER_DOWNLOAD_PATH` it is possible to support downloading the browser binaries into a folder outside the `node_modules` folder. This makes it possible to preserve previously downloaded binaries in order to skip downloading them again.
2020-08-10 10:37:31 +02:00
Mathieu Ferment
615cd37f96
chore: use https URL for license info (#6279) 2020-08-10 10:35:07 +02:00
Clay Walker
b4c1e45388
docs: fix setuid sandbox link (#6310)
Minor documentation fix.
2020-08-10 10:34:09 +02:00
Maja Frydrychowicz
054d782c82
fix(Launcher): use wait-for-process Firefox option (#6315) 2020-08-10 10:23:17 +02:00
Maja Frydrychowicz
996e82c7aa
test(install): check for Firefox binary, clean up messages (#6316) 2020-08-10 10:22:31 +02:00
Maciej Brencz
142f88c7c4
docs(troubleshooting): update Alpine Chromium version (#6320)
The newest Chromium package is now using version 83, which corresponds to Puppeteer v3.1.0.
2020-08-10 07:44:22 +02:00
Johan Bay
8e29b7a38d
chore: rename serializeTree parameter (#6308) 2020-08-05 17:08:19 +02:00
Hugo Des
1d08e274a8
docs(troubleshooting.md) fix error in docker guidelines (#6267) 2020-07-29 12:14:06 +01:00
Christian Bromann
9bc063b5ef
chore: assert location value of ConsoleMessage in tests (#6282) 2020-07-29 12:13:50 +01:00
Jack Franklin
713e990531
chore: upgrade Mitt to 2.1 (#6287)
Fixes #6285.
2020-07-29 12:11:40 +01:00
Jack Franklin
21552f8fe7
feat: page.waitForTimeout (#6268) 2020-07-28 10:37:49 +02:00
Jack Franklin
3a15c06cf5
chore: test Connection class in the browser (#6269)
This commit creates a test that runs in the browser and ensures that we
can instantiate a pptr Connection with a fake transport and send/receive
messages.

Longer term I'd like to have tests that actually connect to a browser
and send CDP messages but that needs some changes to web-test-runner
which I'm going to speak to them about - the DevTools URL needs to be
exposed some how for us to use and connect to.
2020-07-28 09:29:19 +01:00
Jaroslav Maslo
a47b556155
docs(api): fix typo in elementHandle.evaluateHandle() (#6276) 2020-07-27 08:14:19 +02:00