mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: update Prettier and other deps (#10555)
This commit is contained in:
parent
cdd310fe5e
commit
de09b058ba
@ -44,3 +44,5 @@ yarn-error.log*
|
|||||||
# ESLint ignores.
|
# ESLint ignores.
|
||||||
assets/
|
assets/
|
||||||
third_party/
|
third_party/
|
||||||
|
sandbox/
|
||||||
|
ng-schematics/src/**/files/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const prettier = require('prettier');
|
const prettier = require('@prettier/sync');
|
||||||
|
const prettierConfig = require('./.prettierrc.cjs');
|
||||||
|
|
||||||
const cleanupBlockComment = value => {
|
const cleanupBlockComment = value => {
|
||||||
return value
|
return value
|
||||||
@ -18,12 +19,13 @@ const cleanupBlockComment = value => {
|
|||||||
.trim();
|
.trim();
|
||||||
};
|
};
|
||||||
|
|
||||||
const format = (value, offset, prettierOptions) => {
|
const format = (value, offset) => {
|
||||||
return prettier
|
return prettier
|
||||||
.format(value, {
|
.format(value, {
|
||||||
...prettierOptions,
|
...prettierConfig,
|
||||||
|
parser: 'markdown',
|
||||||
// This is the print width minus 3 (the length of ` * `) and the offset.
|
// This is the print width minus 3 (the length of ` * `) and the offset.
|
||||||
printWidth: prettierOptions.printWidth - (offset + 3),
|
printWidth: 80 - (offset + 3),
|
||||||
})
|
})
|
||||||
.trim();
|
.trim();
|
||||||
};
|
};
|
||||||
@ -57,17 +59,12 @@ const rule = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
create(context) {
|
create(context) {
|
||||||
const prettierOptions = {
|
for (const comment of context.sourceCode.getAllComments()) {
|
||||||
printWidth: 80,
|
|
||||||
...prettier.resolveConfig.sync(context.getPhysicalFilename()),
|
|
||||||
parser: 'markdown',
|
|
||||||
};
|
|
||||||
for (const comment of context.getSourceCode().getAllComments()) {
|
|
||||||
switch (comment.type) {
|
switch (comment.type) {
|
||||||
case 'Block': {
|
case 'Block': {
|
||||||
const offset = comment.loc.start.column;
|
const offset = comment.loc.start.column;
|
||||||
const value = cleanupBlockComment(comment.value);
|
const value = cleanupBlockComment(comment.value);
|
||||||
const formattedValue = format(value, offset, prettierOptions);
|
const formattedValue = format(value, offset);
|
||||||
if (formattedValue !== value) {
|
if (formattedValue !== value) {
|
||||||
context.report({
|
context.report({
|
||||||
node: comment,
|
node: comment,
|
||||||
|
@ -134,6 +134,7 @@ module.exports = {
|
|||||||
extends: [
|
extends: [
|
||||||
'plugin:@typescript-eslint/eslint-recommended',
|
'plugin:@typescript-eslint/eslint-recommended',
|
||||||
'plugin:@typescript-eslint/recommended',
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:@typescript-eslint/stylistic',
|
||||||
],
|
],
|
||||||
plugins: ['eslint-plugin-tsdoc', 'local'],
|
plugins: ['eslint-plugin-tsdoc', 'local'],
|
||||||
rules: {
|
rules: {
|
||||||
@ -211,6 +212,7 @@ module.exports = {
|
|||||||
'error',
|
'error',
|
||||||
{ignoreVoid: true, ignoreIIFE: true},
|
{ignoreVoid: true, ignoreIIFE: true},
|
||||||
],
|
],
|
||||||
|
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: ElementFor
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
export type ElementFor<
|
export type ElementFor<
|
||||||
TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap
|
TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap,
|
||||||
> = TagName extends keyof HTMLElementTagNameMap
|
> = TagName extends keyof HTMLElementTagNameMap
|
||||||
? HTMLElementTagNameMap[TagName]
|
? HTMLElementTagNameMap[TagName]
|
||||||
: TagName extends keyof SVGElementTagNameMap
|
: TagName extends keyof SVGElementTagNameMap
|
||||||
|
@ -18,7 +18,7 @@ class ElementHandle {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -18,7 +18,7 @@ class ElementHandle {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -18,7 +18,7 @@ class Frame {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -18,7 +18,7 @@ class Frame {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -12,7 +12,7 @@ Behaves identically to [Page.evaluate()](./puppeteer.page.evaluate.md) except it
|
|||||||
class Frame {
|
class Frame {
|
||||||
evaluate<
|
evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -12,7 +12,7 @@ Behaves identically to [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.m
|
|||||||
class Frame {
|
class Frame {
|
||||||
evaluateHandle<
|
evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -10,7 +10,7 @@ sidebar_label: Frame.waitForFunction
|
|||||||
class Frame {
|
class Frame {
|
||||||
waitForFunction<
|
waitForFunction<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
options?: FrameWaitForFunctionOptions,
|
options?: FrameWaitForFunctionOptions,
|
||||||
|
@ -12,7 +12,7 @@ Evaluates the given function with the current handle as its first argument.
|
|||||||
class JSHandle {
|
class JSHandle {
|
||||||
evaluate<
|
evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
|
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -12,7 +12,7 @@ Evaluates the given function with the current handle as its first argument.
|
|||||||
class JSHandle {
|
class JSHandle {
|
||||||
evaluateHandle<
|
evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
|
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -16,7 +16,7 @@ class Page {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -16,7 +16,7 @@ class Page {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -14,7 +14,7 @@ If the function passed to `page.evaluate` returns a Promise, the function will w
|
|||||||
class Page {
|
class Page {
|
||||||
evaluate<
|
evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -10,7 +10,7 @@ sidebar_label: Page.evaluateHandle
|
|||||||
class Page {
|
class Page {
|
||||||
evaluateHandle<
|
evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -18,7 +18,7 @@ The function is invoked after the document was created but before any of its scr
|
|||||||
class Page {
|
class Page {
|
||||||
evaluateOnNewDocument<
|
evaluateOnNewDocument<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends (...args: Params) => unknown = (...args: Params) => unknown
|
Func extends (...args: Params) => unknown = (...args: Params) => unknown,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -12,7 +12,7 @@ Waits for a function to finish evaluating in the page's context.
|
|||||||
class Page {
|
class Page {
|
||||||
waitForFunction<
|
waitForFunction<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
options?: FrameWaitForFunctionOptions,
|
options?: FrameWaitForFunctionOptions,
|
||||||
|
@ -12,7 +12,7 @@ If the function passed to the `worker.evaluate` returns a Promise, then `worker.
|
|||||||
class WebWorker {
|
class WebWorker {
|
||||||
evaluate<
|
evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -12,7 +12,7 @@ The only difference between `worker.evaluate` and `worker.evaluateHandle` is tha
|
|||||||
class WebWorker {
|
class WebWorker {
|
||||||
evaluateHandle<
|
evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -2,17 +2,19 @@
|
|||||||
sidebar_label: InstalledBrowser
|
sidebar_label: InstalledBrowser
|
||||||
---
|
---
|
||||||
|
|
||||||
# InstalledBrowser type
|
# InstalledBrowser interface
|
||||||
|
|
||||||
#### Signature:
|
#### Signature:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
export type InstalledBrowser = {
|
export interface InstalledBrowser
|
||||||
path: string;
|
|
||||||
browser: Browser;
|
|
||||||
buildId: string;
|
|
||||||
platform: BrowserPlatform;
|
|
||||||
};
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**References:** [Browser](./browsers.browser.md), [BrowserPlatform](./browsers.browserplatform.md)
|
## Properties
|
||||||
|
|
||||||
|
| Property | Modifiers | Type | Description | Default |
|
||||||
|
| -------- | --------- | ------------------------------------------------ | ----------- | ------- |
|
||||||
|
| browser | | [Browser](./browsers.browser.md) | | |
|
||||||
|
| buildId | | string | | |
|
||||||
|
| path | | string | | |
|
||||||
|
| platform | | [BrowserPlatform](./browsers.browserplatform.md) | | |
|
||||||
|
@ -2,21 +2,25 @@
|
|||||||
sidebar_label: LaunchOptions
|
sidebar_label: LaunchOptions
|
||||||
---
|
---
|
||||||
|
|
||||||
# LaunchOptions type
|
# LaunchOptions interface
|
||||||
|
|
||||||
#### Signature:
|
#### Signature:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
export type LaunchOptions = {
|
export interface LaunchOptions
|
||||||
executablePath: string;
|
|
||||||
pipe?: boolean;
|
|
||||||
dumpio?: boolean;
|
|
||||||
args?: string[];
|
|
||||||
env?: Record<string, string | undefined>;
|
|
||||||
handleSIGINT?: boolean;
|
|
||||||
handleSIGTERM?: boolean;
|
|
||||||
handleSIGHUP?: boolean;
|
|
||||||
detached?: boolean;
|
|
||||||
onExit?: () => Promise<void>;
|
|
||||||
};
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Property | Modifiers | Type | Description | Default |
|
||||||
|
| -------------- | --------------------- | ----------------------------------------- | ----------- | ------- |
|
||||||
|
| args | <code>optional</code> | string\[\] | | |
|
||||||
|
| detached | <code>optional</code> | boolean | | |
|
||||||
|
| dumpio | <code>optional</code> | boolean | | |
|
||||||
|
| env | <code>optional</code> | Record<string, string \| undefined> | | |
|
||||||
|
| executablePath | | string | | |
|
||||||
|
| handleSIGHUP | <code>optional</code> | boolean | | |
|
||||||
|
| handleSIGINT | <code>optional</code> | boolean | | |
|
||||||
|
| handleSIGTERM | <code>optional</code> | boolean | | |
|
||||||
|
| onExit | <code>optional</code> | () => Promise<void> | | |
|
||||||
|
| pipe | <code>optional</code> | boolean | | |
|
||||||
|
@ -68,7 +68,9 @@ The programmatic API allows installing and launching browsers from your code. Se
|
|||||||
| Interface | Description |
|
| Interface | Description |
|
||||||
| ------------------------------------------------------------------------ | ----------- |
|
| ------------------------------------------------------------------------ | ----------- |
|
||||||
| [GetInstalledBrowsersOptions](./browsers.getinstalledbrowsersoptions.md) | |
|
| [GetInstalledBrowsersOptions](./browsers.getinstalledbrowsersoptions.md) | |
|
||||||
|
| [InstalledBrowser](./browsers.installedbrowser.md) | |
|
||||||
| [InstallOptions](./browsers.installoptions.md) | |
|
| [InstallOptions](./browsers.installoptions.md) | |
|
||||||
|
| [LaunchOptions](./browsers.launchoptions.md) | |
|
||||||
| [Options](./browsers.options.md) | |
|
| [Options](./browsers.options.md) | |
|
||||||
| [ProfileOptions](./browsers.profileoptions.md) | |
|
| [ProfileOptions](./browsers.profileoptions.md) | |
|
||||||
| [SystemOptions](./browsers.systemoptions.md) | |
|
| [SystemOptions](./browsers.systemoptions.md) | |
|
||||||
@ -80,10 +82,3 @@ The programmatic API allows installing and launching browsers from your code. Se
|
|||||||
| ------------------------------------------------------------------------------------------------ | ----------- |
|
| ------------------------------------------------------------------------------------------------ | ----------- |
|
||||||
| [CDP_WEBSOCKET_ENDPOINT_REGEX](./browsers.cdp_websocket_endpoint_regex.md) | |
|
| [CDP_WEBSOCKET_ENDPOINT_REGEX](./browsers.cdp_websocket_endpoint_regex.md) | |
|
||||||
| [WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX](./browsers.webdriver_bidi_websocket_endpoint_regex.md) | |
|
| [WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX](./browsers.webdriver_bidi_websocket_endpoint_regex.md) | |
|
||||||
|
|
||||||
## Type Aliases
|
|
||||||
|
|
||||||
| Type Alias | Description |
|
|
||||||
| -------------------------------------------------- | ----------- |
|
|
||||||
| [InstalledBrowser](./browsers.installedbrowser.md) | |
|
|
||||||
| [LaunchOptions](./browsers.launchoptions.md) | |
|
|
||||||
|
@ -143,9 +143,11 @@ The following example searches [developer.chrome.com](https://developer.chrome.c
|
|||||||
import puppeteer from 'puppeteer';
|
import puppeteer from 'puppeteer';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
// Launch the browser and open a new blank page
|
||||||
const browser = await puppeteer.launch();
|
const browser = await puppeteer.launch();
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
|
|
||||||
|
// Navigate the page to a URL
|
||||||
await page.goto('https://developer.chrome.com/');
|
await page.goto('https://developer.chrome.com/');
|
||||||
|
|
||||||
// Set screen size
|
// Set screen size
|
||||||
|
2871
package-lock.json
generated
2871
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
41
package.json
41
package.json
@ -123,11 +123,12 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@actions/core": "1.10.0",
|
"@actions/core": "1.10.0",
|
||||||
"@microsoft/api-documenter": "7.22.10",
|
"@microsoft/api-documenter": "7.22.27",
|
||||||
"@microsoft/api-extractor": "7.35.1",
|
"@microsoft/api-extractor": "7.36.2",
|
||||||
"@microsoft/api-extractor-model": "7.27.1",
|
"@microsoft/api-extractor-model": "7.27.4",
|
||||||
"@pptr/testserver": "file:packages/testserver",
|
"@pptr/testserver": "file:packages/testserver",
|
||||||
"@rollup/plugin-commonjs": "25.0.0",
|
"@prettier/sync": "0.2.1",
|
||||||
|
"@rollup/plugin-commonjs": "25.0.2",
|
||||||
"@rollup/plugin-node-resolve": "15.1.0",
|
"@rollup/plugin-node-resolve": "15.1.0",
|
||||||
"@types/debug": "4.1.8",
|
"@types/debug": "4.1.8",
|
||||||
"@types/diff": "5.0.3",
|
"@types/diff": "5.0.3",
|
||||||
@ -141,25 +142,25 @@
|
|||||||
"@types/sinon": "10.0.15",
|
"@types/sinon": "10.0.15",
|
||||||
"@types/tar-fs": "2.0.1",
|
"@types/tar-fs": "2.0.1",
|
||||||
"@types/unbzip2-stream": "1.4.0",
|
"@types/unbzip2-stream": "1.4.0",
|
||||||
"@types/ws": "8.5.4",
|
"@types/ws": "8.5.5",
|
||||||
"@typescript-eslint/eslint-plugin": "5.59.9",
|
"@typescript-eslint/eslint-plugin": "6.0.0",
|
||||||
"@typescript-eslint/parser": "5.59.9",
|
"@typescript-eslint/parser": "6.0.0",
|
||||||
"c8": "7.14.0",
|
"c8": "8.0.0",
|
||||||
"commonmark": "0.30.0",
|
"commonmark": "0.30.0",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"diff": "5.1.0",
|
"diff": "5.1.0",
|
||||||
"esbuild": "0.17.19",
|
"esbuild": "0.18.12",
|
||||||
"eslint": "8.42.0",
|
"eslint": "8.44.0",
|
||||||
"eslint-config-prettier": "8.8.0",
|
"eslint-config-prettier": "8.8.0",
|
||||||
"eslint-formatter-codeframe": "7.32.1",
|
"eslint-formatter-codeframe": "7.32.1",
|
||||||
"eslint-plugin-import": "2.27.5",
|
"eslint-plugin-import": "2.27.5",
|
||||||
"eslint-plugin-local": "1.0.0",
|
"eslint-plugin-local": "1.0.0",
|
||||||
"eslint-plugin-mocha": "10.1.0",
|
"eslint-plugin-mocha": "10.1.0",
|
||||||
"eslint-plugin-prettier": "4.2.1",
|
"eslint-plugin-prettier": "5.0.0",
|
||||||
"eslint-plugin-tsdoc": "0.2.17",
|
"eslint-plugin-tsdoc": "0.2.17",
|
||||||
"eslint-plugin-unused-imports": "2.0.0",
|
"eslint-plugin-unused-imports": "3.0.0",
|
||||||
"esprima": "4.0.1",
|
"esprima": "4.0.1",
|
||||||
"expect": "29.5.0",
|
"expect": "29.6.1",
|
||||||
"glob": "10.3.3",
|
"glob": "10.3.3",
|
||||||
"gts": "4.0.1",
|
"gts": "4.0.1",
|
||||||
"jpeg-js": "0.4.4",
|
"jpeg-js": "0.4.4",
|
||||||
@ -171,20 +172,20 @@
|
|||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"pixelmatch": "5.3.0",
|
"pixelmatch": "5.3.0",
|
||||||
"pngjs": "7.0.0",
|
"pngjs": "7.0.0",
|
||||||
"prettier": "2.8.8",
|
"prettier": "3.0.0",
|
||||||
"puppeteer": "file:packages/puppeteer",
|
"puppeteer": "file:packages/puppeteer",
|
||||||
"rimraf": "5.0.1",
|
"rimraf": "5.0.1",
|
||||||
"rollup": "3.24.0",
|
"rollup": "3.26.2",
|
||||||
"semver": "7.5.1",
|
"semver": "7.5.4",
|
||||||
"sinon": "15.1.0",
|
"sinon": "15.2.0",
|
||||||
"source-map-support": "0.5.21",
|
"source-map-support": "0.5.21",
|
||||||
"spdx-satisfies": "5.0.1",
|
"spdx-satisfies": "5.0.1",
|
||||||
"text-diff": "1.0.1",
|
"text-diff": "1.0.1",
|
||||||
"tsd": "0.28.1",
|
"tsd": "0.28.1",
|
||||||
"tsx": "3.12.7",
|
"tsx": "3.12.7",
|
||||||
"typescript": "5.1.3",
|
"typescript": "5.1.6",
|
||||||
"wireit": "0.9.5",
|
"wireit": "0.10.0",
|
||||||
"zod": "3.21.2"
|
"zod": "3.21.4"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
|
@ -37,7 +37,7 @@ import {
|
|||||||
launch,
|
launch,
|
||||||
} from './launch.js';
|
} from './launch.js';
|
||||||
|
|
||||||
type InstallArgs = {
|
interface InstallArgs {
|
||||||
browser: {
|
browser: {
|
||||||
name: Browser;
|
name: Browser;
|
||||||
buildId: string;
|
buildId: string;
|
||||||
@ -45,9 +45,9 @@ type InstallArgs = {
|
|||||||
path?: string;
|
path?: string;
|
||||||
platform?: BrowserPlatform;
|
platform?: BrowserPlatform;
|
||||||
baseUrl?: string;
|
baseUrl?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
type LaunchArgs = {
|
interface LaunchArgs {
|
||||||
browser: {
|
browser: {
|
||||||
name: Browser;
|
name: Browser;
|
||||||
buildId: string;
|
buildId: string;
|
||||||
@ -56,11 +56,11 @@ type LaunchArgs = {
|
|||||||
platform?: BrowserPlatform;
|
platform?: BrowserPlatform;
|
||||||
detached: boolean;
|
detached: boolean;
|
||||||
system: boolean;
|
system: boolean;
|
||||||
};
|
}
|
||||||
|
|
||||||
type ClearArgs = {
|
interface ClearArgs {
|
||||||
path?: string;
|
path?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
|
@ -22,12 +22,12 @@ import {Browser, BrowserPlatform} from './browser-data/browser-data.js';
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export type InstalledBrowser = {
|
export interface InstalledBrowser {
|
||||||
path: string;
|
path: string;
|
||||||
browser: Browser;
|
browser: Browser;
|
||||||
buildId: string;
|
buildId: string;
|
||||||
platform: BrowserPlatform;
|
platform: BrowserPlatform;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cache used by Puppeteer relies on the following structure:
|
* The cache used by Puppeteer relies on the following structure:
|
||||||
|
@ -80,9 +80,7 @@ export async function getLastKnownGoodReleaseForChannel(
|
|||||||
'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json'
|
'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json'
|
||||||
)
|
)
|
||||||
)) as {
|
)) as {
|
||||||
channels: {
|
channels: Record<string, {version: string}>;
|
||||||
[channel: string]: {version: string};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const channel of Object.keys(data.channels)) {
|
for (const channel of Object.keys(data.channels)) {
|
||||||
|
@ -70,9 +70,7 @@ export async function resolveBuildId(
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const versions = (await getJSON(
|
const versions = (await getJSON(
|
||||||
new URL('https://product-details.mozilla.org/1.0/firefox_versions.json')
|
new URL('https://product-details.mozilla.org/1.0/firefox_versions.json')
|
||||||
)) as {
|
)) as Record<string, string>;
|
||||||
[channel: string]: string;
|
|
||||||
};
|
|
||||||
const version = versions[channel];
|
const version = versions[channel];
|
||||||
if (!version) {
|
if (!version) {
|
||||||
throw new Error(`Channel ${channel} is not found.`);
|
throw new Error(`Channel ${channel} is not found.`);
|
||||||
|
@ -129,7 +129,7 @@ export function computeSystemExecutablePath(options: SystemOptions): string {
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export type LaunchOptions = {
|
export interface LaunchOptions {
|
||||||
executablePath: string;
|
executablePath: string;
|
||||||
pipe?: boolean;
|
pipe?: boolean;
|
||||||
dumpio?: boolean;
|
dumpio?: boolean;
|
||||||
@ -140,7 +140,7 @@ export type LaunchOptions = {
|
|||||||
handleSIGHUP?: boolean;
|
handleSIGHUP?: boolean;
|
||||||
detached?: boolean;
|
detached?: boolean;
|
||||||
onExit?: () => Promise<void>;
|
onExit?: () => Promise<void>;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
/files/
|
/files/
|
||||||
|
|
||||||
# Ignore sandbox enviroment
|
# Ignore sandbox enviroment
|
||||||
./sandbox/
|
./sandbox/
|
||||||
|
@ -135,7 +135,7 @@ export interface Point {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export class ElementHandle<
|
export class ElementHandle<
|
||||||
ElementType extends Node = Element
|
ElementType extends Node = Element,
|
||||||
> extends JSHandle<ElementType> {
|
> extends JSHandle<ElementType> {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -195,7 +195,7 @@ export class ElementHandle<
|
|||||||
Func extends EvaluateFuncWith<ElementType, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<ElementType, Params> = EvaluateFuncWith<
|
||||||
ElementType,
|
ElementType,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -211,7 +211,7 @@ export class ElementHandle<
|
|||||||
Func extends EvaluateFuncWith<ElementType, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<ElementType, Params> = EvaluateFuncWith<
|
||||||
ElementType,
|
ElementType,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -329,7 +329,7 @@ export class ElementHandle<
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -386,7 +386,7 @@ export class ElementHandle<
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -394,9 +394,12 @@ export class ElementHandle<
|
|||||||
): Promise<Awaited<ReturnType<Func>>> {
|
): Promise<Awaited<ReturnType<Func>>> {
|
||||||
pageFunction = withSourcePuppeteerURLIfNone(this.$$eval.name, pageFunction);
|
pageFunction = withSourcePuppeteerURLIfNone(this.$$eval.name, pageFunction);
|
||||||
const results = await this.$$(selector);
|
const results = await this.$$(selector);
|
||||||
const elements = await this.evaluateHandle((_, ...elements) => {
|
const elements = await this.evaluateHandle(
|
||||||
return elements;
|
(_, ...elements) => {
|
||||||
}, ...results);
|
return elements;
|
||||||
|
},
|
||||||
|
...results
|
||||||
|
);
|
||||||
const [result] = await Promise.all([
|
const [result] = await Promise.all([
|
||||||
elements.evaluate(pageFunction, ...args),
|
elements.evaluate(pageFunction, ...args),
|
||||||
...results.map(results => {
|
...results.map(results => {
|
||||||
@ -606,7 +609,7 @@ export class ElementHandle<
|
|||||||
* automatically disposed.**
|
* automatically disposed.**
|
||||||
*/
|
*/
|
||||||
async toElement<
|
async toElement<
|
||||||
K extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap
|
K extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap,
|
||||||
>(tagName: K): Promise<HandleFor<ElementFor<K>>> {
|
>(tagName: K): Promise<HandleFor<ElementFor<K>>> {
|
||||||
const isMatchingTagName = await this.evaluate((node, tagName) => {
|
const isMatchingTagName = await this.evaluate((node, tagName) => {
|
||||||
return node.nodeName === tagName.toUpperCase();
|
return node.nodeName === tagName.toUpperCase();
|
||||||
|
@ -48,7 +48,7 @@ export interface Realm {
|
|||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<InnerLazyParams<Params>> = EvaluateFunc<
|
Func extends EvaluateFunc<InnerLazyParams<Params>> = EvaluateFunc<
|
||||||
InnerLazyParams<Params>
|
InnerLazyParams<Params>
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
options: {
|
options: {
|
||||||
@ -63,14 +63,14 @@ export interface Realm {
|
|||||||
transferHandle<T extends JSHandle<Node>>(handle: T): Promise<T>;
|
transferHandle<T extends JSHandle<Node>>(handle: T): Promise<T>;
|
||||||
evaluateHandle<
|
evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
||||||
evaluate<
|
evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -382,14 +382,14 @@ export class Frame {
|
|||||||
*/
|
*/
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(): Promise<HandleFor<Awaited<ReturnType<Func>>>> {
|
>(): Promise<HandleFor<Awaited<ReturnType<Func>>>> {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
@ -402,14 +402,14 @@ export class Frame {
|
|||||||
*/
|
*/
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
): Promise<Awaited<ReturnType<Func>>>;
|
): Promise<Awaited<ReturnType<Func>>>;
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(): Promise<Awaited<ReturnType<Func>>> {
|
>(): Promise<Awaited<ReturnType<Func>>> {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
@ -484,7 +484,7 @@ export class Frame {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -496,7 +496,7 @@ export class Frame {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(): Promise<Awaited<ReturnType<Func>>> {
|
>(): Promise<Awaited<ReturnType<Func>>> {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
@ -527,7 +527,7 @@ export class Frame {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -539,7 +539,7 @@ export class Frame {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(): Promise<Awaited<ReturnType<Func>>> {
|
>(): Promise<Awaited<ReturnType<Func>>> {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
@ -674,7 +674,7 @@ export class Frame {
|
|||||||
*/
|
*/
|
||||||
waitForFunction<
|
waitForFunction<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
options: FrameWaitForFunctionOptions = {},
|
options: FrameWaitForFunctionOptions = {},
|
||||||
|
@ -500,7 +500,7 @@ export function headersArray(
|
|||||||
* List taken from {@link https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml}
|
* List taken from {@link https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml}
|
||||||
* with extra 306 and 418 codes.
|
* with extra 306 and 418 codes.
|
||||||
*/
|
*/
|
||||||
export const STATUS_TEXTS: {[key: string]: string | undefined} = {
|
export const STATUS_TEXTS: Record<string, string | undefined> = {
|
||||||
'100': 'Continue',
|
'100': 'Continue',
|
||||||
'101': 'Switching Protocols',
|
'101': 'Switching Protocols',
|
||||||
'102': 'Processing',
|
'102': 'Processing',
|
||||||
|
@ -82,7 +82,7 @@ export class JSHandle<T = unknown> {
|
|||||||
*/
|
*/
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
|
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -97,7 +97,7 @@ export class JSHandle<T = unknown> {
|
|||||||
*/
|
*/
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
|
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -930,14 +930,14 @@ export class Page extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(): Promise<HandleFor<Awaited<ReturnType<Func>>>> {
|
>(): Promise<HandleFor<Awaited<ReturnType<Func>>>> {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
@ -1040,7 +1040,7 @@ export class Page extends EventEmitter {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -1118,7 +1118,7 @@ export class Page extends EventEmitter {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -2167,14 +2167,14 @@ export class Page extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
): Promise<Awaited<ReturnType<Func>>>;
|
): Promise<Awaited<ReturnType<Func>>>;
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(): Promise<Awaited<ReturnType<Func>>> {
|
>(): Promise<Awaited<ReturnType<Func>>> {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
@ -2213,7 +2213,7 @@ export class Page extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
async evaluateOnNewDocument<
|
async evaluateOnNewDocument<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends (...args: Params) => unknown = (...args: Params) => unknown
|
Func extends (...args: Params) => unknown = (...args: Params) => unknown,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -2773,7 +2773,7 @@ export class Page extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
waitForFunction<
|
waitForFunction<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
options?: FrameWaitForFunctionOptions,
|
options?: FrameWaitForFunctionOptions,
|
||||||
|
@ -40,7 +40,10 @@ const queryAXTree = async (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
type ARIASelector = {name?: string; role?: string};
|
interface ARIASelector {
|
||||||
|
name?: string;
|
||||||
|
role?: string;
|
||||||
|
}
|
||||||
|
|
||||||
const KNOWN_ATTRIBUTES = Object.freeze(['name', 'role']);
|
const KNOWN_ATTRIBUTES = Object.freeze(['name', 'role']);
|
||||||
const isKnownAttribute = (
|
const isKnownAttribute = (
|
||||||
|
@ -50,17 +50,16 @@ export class ChromeTargetManager extends EventEmitter implements TargetManager {
|
|||||||
*
|
*
|
||||||
* `targetFilterCallback` has no effect on this map.
|
* `targetFilterCallback` has no effect on this map.
|
||||||
*/
|
*/
|
||||||
#discoveredTargetsByTargetId: Map<string, Protocol.Target.TargetInfo> =
|
#discoveredTargetsByTargetId = new Map<string, Protocol.Target.TargetInfo>();
|
||||||
new Map();
|
|
||||||
/**
|
/**
|
||||||
* A target is added to this map once ChromeTargetManager has created
|
* A target is added to this map once ChromeTargetManager has created
|
||||||
* a Target and attached at least once to it.
|
* a Target and attached at least once to it.
|
||||||
*/
|
*/
|
||||||
#attachedTargetsByTargetId: Map<string, Target> = new Map();
|
#attachedTargetsByTargetId = new Map<string, Target>();
|
||||||
/**
|
/**
|
||||||
* Tracks which sessions attach to which target.
|
* Tracks which sessions attach to which target.
|
||||||
*/
|
*/
|
||||||
#attachedTargetsBySessionId: Map<string, Target> = new Map();
|
#attachedTargetsBySessionId = new Map<string, Target>();
|
||||||
/**
|
/**
|
||||||
* If a target was filtered out by `targetFilterCallback`, we still receive
|
* If a target was filtered out by `targetFilterCallback`, we still receive
|
||||||
* events about it from CDP, but we don't forward them to the rest of Puppeteer.
|
* events about it from CDP, but we don't forward them to the rest of Puppeteer.
|
||||||
@ -69,20 +68,22 @@ export class ChromeTargetManager extends EventEmitter implements TargetManager {
|
|||||||
#targetFilterCallback: TargetFilterCallback | undefined;
|
#targetFilterCallback: TargetFilterCallback | undefined;
|
||||||
#targetFactory: TargetFactory;
|
#targetFactory: TargetFactory;
|
||||||
|
|
||||||
#targetInterceptors: WeakMap<CDPSession | Connection, TargetInterceptor[]> =
|
#targetInterceptors = new WeakMap<
|
||||||
new WeakMap();
|
CDPSession | Connection,
|
||||||
|
TargetInterceptor[]
|
||||||
|
>();
|
||||||
|
|
||||||
#attachedToTargetListenersBySession: WeakMap<
|
#attachedToTargetListenersBySession = new WeakMap<
|
||||||
CDPSession | Connection,
|
CDPSession | Connection,
|
||||||
(event: Protocol.Target.AttachedToTargetEvent) => Promise<void>
|
(event: Protocol.Target.AttachedToTargetEvent) => Promise<void>
|
||||||
> = new WeakMap();
|
>();
|
||||||
#detachedFromTargetListenersBySession: WeakMap<
|
#detachedFromTargetListenersBySession = new WeakMap<
|
||||||
CDPSession | Connection,
|
CDPSession | Connection,
|
||||||
(event: Protocol.Target.DetachedFromTargetEvent) => void
|
(event: Protocol.Target.DetachedFromTargetEvent) => void
|
||||||
> = new WeakMap();
|
>();
|
||||||
|
|
||||||
#initializeDeferred = Deferred.create<void>();
|
#initializeDeferred = Deferred.create<void>();
|
||||||
#targetsIdsForInit: Set<string> = new Set();
|
#targetsIdsForInit = new Set<string>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
|
@ -116,7 +116,7 @@ export class Callback {
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export class CallbackRegistry {
|
export class CallbackRegistry {
|
||||||
#callbacks: Map<number, Callback> = new Map();
|
#callbacks = new Map<number, Callback>();
|
||||||
#idGenerator = createIncrementalIdGenerator();
|
#idGenerator = createIncrementalIdGenerator();
|
||||||
|
|
||||||
create(
|
create(
|
||||||
@ -197,7 +197,7 @@ export class Connection extends EventEmitter {
|
|||||||
#transport: ConnectionTransport;
|
#transport: ConnectionTransport;
|
||||||
#delay: number;
|
#delay: number;
|
||||||
#timeout: number;
|
#timeout: number;
|
||||||
#sessions: Map<string, CDPSessionImpl> = new Map();
|
#sessions = new Map<string, CDPSessionImpl>();
|
||||||
#closed = false;
|
#closed = false;
|
||||||
#manuallyAttached = new Set<string>();
|
#manuallyAttached = new Set<string>();
|
||||||
#callbacks = new CallbackRegistry();
|
#callbacks = new CallbackRegistry();
|
||||||
|
@ -57,7 +57,7 @@ const applyOffsetsToQuad = (
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export class CDPElementHandle<
|
export class CDPElementHandle<
|
||||||
ElementType extends Node = Element
|
ElementType extends Node = Element,
|
||||||
> extends ElementHandle<ElementType> {
|
> extends ElementHandle<ElementType> {
|
||||||
#frame: Frame;
|
#frame: Frame;
|
||||||
declare handle: CDPJSHandle<ElementType>;
|
declare handle: CDPJSHandle<ElementType>;
|
||||||
|
@ -105,9 +105,12 @@ export class ExecutionContext {
|
|||||||
selector: string
|
selector: string
|
||||||
): Promise<JSHandle<Node[]>> => {
|
): Promise<JSHandle<Node[]>> => {
|
||||||
const results = ARIAQueryHandler.queryAll(element, selector);
|
const results = ARIAQueryHandler.queryAll(element, selector);
|
||||||
return element.executionContext().evaluateHandle((...elements) => {
|
return element.executionContext().evaluateHandle(
|
||||||
return elements;
|
(...elements) => {
|
||||||
}, ...(await AsyncIterableUtil.collect(results)));
|
return elements;
|
||||||
|
},
|
||||||
|
...(await AsyncIterableUtil.collect(results))
|
||||||
|
);
|
||||||
}) as (...args: unknown[]) => unknown)
|
}) as (...args: unknown[]) => unknown)
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
@ -181,7 +184,7 @@ export class ExecutionContext {
|
|||||||
*/
|
*/
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -240,7 +243,7 @@ export class ExecutionContext {
|
|||||||
*/
|
*/
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -250,7 +253,7 @@ export class ExecutionContext {
|
|||||||
|
|
||||||
async #evaluate<
|
async #evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
returnByValue: true,
|
returnByValue: true,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -258,7 +261,7 @@ export class ExecutionContext {
|
|||||||
): Promise<Awaited<ReturnType<Func>>>;
|
): Promise<Awaited<ReturnType<Func>>>;
|
||||||
async #evaluate<
|
async #evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
returnByValue: false,
|
returnByValue: false,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -266,7 +269,7 @@ export class ExecutionContext {
|
|||||||
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
||||||
async #evaluate<
|
async #evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
returnByValue: boolean,
|
returnByValue: boolean,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -59,19 +59,18 @@ export class FirefoxTargetManager
|
|||||||
*
|
*
|
||||||
* `targetFilterCallback` has no effect on this map.
|
* `targetFilterCallback` has no effect on this map.
|
||||||
*/
|
*/
|
||||||
#discoveredTargetsByTargetId: Map<string, Protocol.Target.TargetInfo> =
|
#discoveredTargetsByTargetId = new Map<string, Protocol.Target.TargetInfo>();
|
||||||
new Map();
|
|
||||||
/**
|
/**
|
||||||
* Keeps track of targets that were created via 'Target.targetCreated'
|
* Keeps track of targets that were created via 'Target.targetCreated'
|
||||||
* and which one are not filtered out by `targetFilterCallback`.
|
* and which one are not filtered out by `targetFilterCallback`.
|
||||||
*
|
*
|
||||||
* The target is removed from here once it's been destroyed.
|
* The target is removed from here once it's been destroyed.
|
||||||
*/
|
*/
|
||||||
#availableTargetsByTargetId: Map<string, Target> = new Map();
|
#availableTargetsByTargetId = new Map<string, Target>();
|
||||||
/**
|
/**
|
||||||
* Tracks which sessions attach to which target.
|
* Tracks which sessions attach to which target.
|
||||||
*/
|
*/
|
||||||
#availableTargetsBySessionId: Map<string, Target> = new Map();
|
#availableTargetsBySessionId = new Map<string, Target>();
|
||||||
/**
|
/**
|
||||||
* If a target was filtered out by `targetFilterCallback`, we still receive
|
* If a target was filtered out by `targetFilterCallback`, we still receive
|
||||||
* events about it from CDP, but we don't forward them to the rest of Puppeteer.
|
* events about it from CDP, but we don't forward them to the rest of Puppeteer.
|
||||||
@ -80,16 +79,18 @@ export class FirefoxTargetManager
|
|||||||
#targetFilterCallback: TargetFilterCallback | undefined;
|
#targetFilterCallback: TargetFilterCallback | undefined;
|
||||||
#targetFactory: TargetFactory;
|
#targetFactory: TargetFactory;
|
||||||
|
|
||||||
#targetInterceptors: WeakMap<CDPSession | Connection, TargetInterceptor[]> =
|
#targetInterceptors = new WeakMap<
|
||||||
new WeakMap();
|
CDPSession | Connection,
|
||||||
|
TargetInterceptor[]
|
||||||
|
>();
|
||||||
|
|
||||||
#attachedToTargetListenersBySession: WeakMap<
|
#attachedToTargetListenersBySession = new WeakMap<
|
||||||
CDPSession | Connection,
|
CDPSession | Connection,
|
||||||
(event: Protocol.Target.AttachedToTargetEvent) => Promise<void>
|
(event: Protocol.Target.AttachedToTargetEvent) => Promise<void>
|
||||||
> = new WeakMap();
|
>();
|
||||||
|
|
||||||
#initializeDeferred = Deferred.create<void>();
|
#initializeDeferred = Deferred.create<void>();
|
||||||
#targetsIdsForInit: Set<string> = new Set();
|
#targetsIdsForInit = new Set<string>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
|
@ -231,7 +231,7 @@ export class Frame extends BaseFrame {
|
|||||||
|
|
||||||
override async evaluateHandle<
|
override async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -245,7 +245,7 @@ export class Frame extends BaseFrame {
|
|||||||
|
|
||||||
override async evaluate<
|
override async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -275,7 +275,7 @@ export class Frame extends BaseFrame {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -291,7 +291,7 @@ export class Frame extends BaseFrame {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -182,7 +182,7 @@ export class IsolatedWorld implements Realm {
|
|||||||
|
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -197,7 +197,7 @@ export class IsolatedWorld implements Realm {
|
|||||||
|
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -246,7 +246,7 @@ export class IsolatedWorld implements Realm {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -263,7 +263,7 @@ export class IsolatedWorld implements Realm {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -444,7 +444,7 @@ export class IsolatedWorld implements Realm {
|
|||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<InnerLazyParams<Params>> = EvaluateFunc<
|
Func extends EvaluateFunc<InnerLazyParams<Params>> = EvaluateFunc<
|
||||||
InnerLazyParams<Params>
|
InnerLazyParams<Params>
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
options: {
|
options: {
|
||||||
|
@ -71,7 +71,7 @@ export class CDPJSHandle<T = unknown> extends JSHandle<T> {
|
|||||||
*/
|
*/
|
||||||
override async evaluate<
|
override async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
|
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -88,7 +88,7 @@ export class CDPJSHandle<T = unknown> extends JSHandle<T> {
|
|||||||
*/
|
*/
|
||||||
override async evaluateHandle<
|
override async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
|
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -21,11 +21,11 @@ import {HTTPRequest} from './HTTPRequest.js';
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export type QueuedEventGroup = {
|
export interface QueuedEventGroup {
|
||||||
responseReceivedEvent: Protocol.Network.ResponseReceivedEvent;
|
responseReceivedEvent: Protocol.Network.ResponseReceivedEvent;
|
||||||
loadingFinishedEvent?: Protocol.Network.LoadingFinishedEvent;
|
loadingFinishedEvent?: Protocol.Network.LoadingFinishedEvent;
|
||||||
loadingFailedEvent?: Protocol.Network.LoadingFailedEvent;
|
loadingFailedEvent?: Protocol.Network.LoadingFailedEvent;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -35,10 +35,10 @@ export type FetchRequestId = string;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export type RedirectInfo = {
|
export interface RedirectInfo {
|
||||||
event: Protocol.Network.RequestWillBeSentEvent;
|
event: Protocol.Network.RequestWillBeSentEvent;
|
||||||
fetchRequestId?: FetchRequestId;
|
fetchRequestId?: FetchRequestId;
|
||||||
};
|
}
|
||||||
type RedirectInfoList = RedirectInfo[];
|
type RedirectInfoList = RedirectInfo[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -495,7 +495,7 @@ export class CDPPage extends Page {
|
|||||||
|
|
||||||
override async evaluateHandle<
|
override async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -1076,7 +1076,7 @@ export class CDPPage extends Page {
|
|||||||
|
|
||||||
override async evaluate<
|
override async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -1090,7 +1090,7 @@ export class CDPPage extends Page {
|
|||||||
|
|
||||||
override async evaluateOnNewDocument<
|
override async evaluateOnNewDocument<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends (...args: Params) => unknown = (...args: Params) => unknown
|
Func extends (...args: Params) => unknown = (...args: Params) => unknown,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -149,7 +149,7 @@ export class WebWorker extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -176,7 +176,7 @@ export class WebWorker extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -26,7 +26,7 @@ import {BrowsingContext} from './BrowsingContext.js';
|
|||||||
const debugProtocolSend = debug('puppeteer:webDriverBiDi:SEND ►');
|
const debugProtocolSend = debug('puppeteer:webDriverBiDi:SEND ►');
|
||||||
const debugProtocolReceive = debug('puppeteer:webDriverBiDi:RECV ◀');
|
const debugProtocolReceive = debug('puppeteer:webDriverBiDi:RECV ◀');
|
||||||
|
|
||||||
type Capability = {
|
interface Capability {
|
||||||
// session.CapabilityRequest = {
|
// session.CapabilityRequest = {
|
||||||
// ? acceptInsecureCerts: bool,
|
// ? acceptInsecureCerts: bool,
|
||||||
// ? browserName: text,
|
// ? browserName: text,
|
||||||
@ -47,7 +47,7 @@ type Capability = {
|
|||||||
acceptInsecureCerts?: boolean;
|
acceptInsecureCerts?: boolean;
|
||||||
browserName?: string;
|
browserName?: string;
|
||||||
browserVersion?: string;
|
browserVersion?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -155,7 +155,7 @@ export class Connection extends EventEmitter {
|
|||||||
#timeout? = 0;
|
#timeout? = 0;
|
||||||
#closed = false;
|
#closed = false;
|
||||||
#callbacks = new CallbackRegistry();
|
#callbacks = new CallbackRegistry();
|
||||||
#browsingContexts: Map<string, BrowsingContext> = new Map();
|
#browsingContexts = new Map<string, BrowsingContext>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
url: string,
|
url: string,
|
||||||
|
@ -32,7 +32,7 @@ import {Realm} from './Realm.js';
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export class ElementHandle<
|
export class ElementHandle<
|
||||||
ElementType extends Node = Element
|
ElementType extends Node = Element,
|
||||||
> extends BaseElementHandle<ElementType> {
|
> extends BaseElementHandle<ElementType> {
|
||||||
declare handle: JSHandle<ElementType>;
|
declare handle: JSHandle<ElementType>;
|
||||||
#frame: Frame;
|
#frame: Frame;
|
||||||
|
@ -104,7 +104,7 @@ export class Frame extends BaseFrame {
|
|||||||
|
|
||||||
override async evaluateHandle<
|
override async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -114,7 +114,7 @@ export class Frame extends BaseFrame {
|
|||||||
|
|
||||||
override async evaluate<
|
override async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -175,7 +175,7 @@ export class Frame extends BaseFrame {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: string | Func,
|
pageFunction: string | Func,
|
||||||
@ -191,7 +191,7 @@ export class Frame extends BaseFrame {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: string | Func,
|
pageFunction: string | Func,
|
||||||
|
@ -46,7 +46,7 @@ export class JSHandle<T = unknown> extends BaseJSHandle<T> {
|
|||||||
|
|
||||||
override async evaluate<
|
override async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
|
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -60,7 +60,7 @@ export class JSHandle<T = unknown> extends BaseJSHandle<T> {
|
|||||||
|
|
||||||
override async evaluateHandle<
|
override async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
|
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -97,7 +97,7 @@ export class JSHandle<T = unknown> extends BaseJSHandle<T> {
|
|||||||
}
|
}
|
||||||
return enumerableKeys;
|
return enumerableKeys;
|
||||||
});
|
});
|
||||||
const map: Map<string, BaseJSHandle> = new Map();
|
const map = new Map<string, BaseJSHandle>();
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
keys.map(key => {
|
keys.map(key => {
|
||||||
return this.getProperty(key);
|
return this.getProperty(key);
|
||||||
|
@ -349,7 +349,7 @@ export class Page extends PageBase {
|
|||||||
|
|
||||||
override async evaluateHandle<
|
override async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -363,7 +363,7 @@ export class Page extends PageBase {
|
|||||||
|
|
||||||
override async evaluate<
|
override async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
|
@ -66,7 +66,7 @@ export class Realm extends EventEmitter {
|
|||||||
|
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -76,7 +76,7 @@ export class Realm extends EventEmitter {
|
|||||||
|
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -86,7 +86,7 @@ export class Realm extends EventEmitter {
|
|||||||
|
|
||||||
async #evaluate<
|
async #evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
returnByValue: true,
|
returnByValue: true,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -94,7 +94,7 @@ export class Realm extends EventEmitter {
|
|||||||
): Promise<Awaited<ReturnType<Func>>>;
|
): Promise<Awaited<ReturnType<Func>>>;
|
||||||
async #evaluate<
|
async #evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
returnByValue: false,
|
returnByValue: false,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -102,7 +102,7 @@ export class Realm extends EventEmitter {
|
|||||||
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
||||||
async #evaluate<
|
async #evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
returnByValue: boolean,
|
returnByValue: boolean,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
|
@ -105,7 +105,7 @@ export class Sandbox implements RealmBase {
|
|||||||
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
|
||||||
NodeFor<Selector>,
|
NodeFor<Selector>,
|
||||||
Params
|
Params
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -122,7 +122,7 @@ export class Sandbox implements RealmBase {
|
|||||||
Func extends EvaluateFuncWith<
|
Func extends EvaluateFuncWith<
|
||||||
Array<NodeFor<Selector>>,
|
Array<NodeFor<Selector>>,
|
||||||
Params
|
Params
|
||||||
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
|
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
|
||||||
>(
|
>(
|
||||||
selector: Selector,
|
selector: Selector,
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
@ -140,7 +140,7 @@ export class Sandbox implements RealmBase {
|
|||||||
|
|
||||||
async evaluateHandle<
|
async evaluateHandle<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -154,7 +154,7 @@ export class Sandbox implements RealmBase {
|
|||||||
|
|
||||||
async evaluate<
|
async evaluate<
|
||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
...args: Params
|
...args: Params
|
||||||
@ -188,7 +188,7 @@ export class Sandbox implements RealmBase {
|
|||||||
Params extends unknown[],
|
Params extends unknown[],
|
||||||
Func extends EvaluateFunc<InnerLazyParams<Params>> = EvaluateFunc<
|
Func extends EvaluateFunc<InnerLazyParams<Params>> = EvaluateFunc<
|
||||||
InnerLazyParams<Params>
|
InnerLazyParams<Params>
|
||||||
>
|
>,
|
||||||
>(
|
>(
|
||||||
pageFunction: Func | string,
|
pageFunction: Func | string,
|
||||||
options: {
|
options: {
|
||||||
|
@ -247,7 +247,7 @@ export class BidiSerializer {
|
|||||||
|
|
||||||
static deserializeTuple([serializedKey, serializedValue]: [
|
static deserializeTuple([serializedKey, serializedValue]: [
|
||||||
Bidi.CommonDataTypes.RemoteValue | string,
|
Bidi.CommonDataTypes.RemoteValue | string,
|
||||||
Bidi.CommonDataTypes.RemoteValue
|
Bidi.CommonDataTypes.RemoteValue,
|
||||||
]): {key: unknown; value: unknown} {
|
]): {key: unknown; value: unknown} {
|
||||||
const key =
|
const key =
|
||||||
typeof serializedKey === 'string'
|
typeof serializedKey === 'string'
|
||||||
|
@ -22,7 +22,7 @@ import type {LazyArg} from './LazyArg.js';
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export type BindingPayload = {
|
export interface BindingPayload {
|
||||||
type: string;
|
type: string;
|
||||||
name: string;
|
name: string;
|
||||||
seq: number;
|
seq: number;
|
||||||
@ -31,7 +31,7 @@ export type BindingPayload = {
|
|||||||
* Determines whether the arguments of the payload are trivial.
|
* Determines whether the arguments of the payload are trivial.
|
||||||
*/
|
*/
|
||||||
isTrivial: boolean;
|
isTrivial: boolean;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -86,7 +86,7 @@ export type InnerParams<T extends unknown[]> = {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export type ElementFor<
|
export type ElementFor<
|
||||||
TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap
|
TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap,
|
||||||
> = TagName extends keyof HTMLElementTagNameMap
|
> = TagName extends keyof HTMLElementTagNameMap
|
||||||
? HTMLElementTagNameMap[TagName]
|
? HTMLElementTagNameMap[TagName]
|
||||||
: TagName extends keyof SVGElementTagNameMap
|
: TagName extends keyof SVGElementTagNameMap
|
||||||
@ -144,7 +144,7 @@ type TypeSelectorOfCompoundSelector<CompoundSelector extends string> =
|
|||||||
|
|
||||||
type Last<Arr extends NonEmptyReadonlyArray<unknown>> = Arr extends [
|
type Last<Arr extends NonEmptyReadonlyArray<unknown>> = Arr extends [
|
||||||
infer Head,
|
infer Head,
|
||||||
...infer Tail
|
...infer Tail,
|
||||||
]
|
]
|
||||||
? Tail extends NonEmptyReadonlyArray<unknown>
|
? Tail extends NonEmptyReadonlyArray<unknown>
|
||||||
? Last<Tail>
|
? Last<Tail>
|
||||||
@ -165,7 +165,7 @@ type CompoundSelectorsOfComplexSelector<ComplexSelector extends string> =
|
|||||||
|
|
||||||
type SplitWithDelemiters<
|
type SplitWithDelemiters<
|
||||||
Input extends string,
|
Input extends string,
|
||||||
Delemiters extends readonly string[]
|
Delemiters extends readonly string[],
|
||||||
> = Delemiters extends [infer FirstDelemiter, ...infer RestDelemiters]
|
> = Delemiters extends [infer FirstDelemiter, ...infer RestDelemiters]
|
||||||
? FirstDelemiter extends string
|
? FirstDelemiter extends string
|
||||||
? RestDelemiters extends readonly string[]
|
? RestDelemiters extends readonly string[]
|
||||||
@ -181,7 +181,7 @@ type CombinatorTokens = [' ', '>', '+', '~', '|', '|'];
|
|||||||
type Drop<
|
type Drop<
|
||||||
Arr extends readonly unknown[],
|
Arr extends readonly unknown[],
|
||||||
Remove,
|
Remove,
|
||||||
Acc extends unknown[] = []
|
Acc extends unknown[] = [],
|
||||||
> = Arr extends [infer Head, ...infer Tail]
|
> = Arr extends [infer Head, ...infer Tail]
|
||||||
? Head extends Remove
|
? Head extends Remove
|
||||||
? Drop<Tail, Remove>
|
? Drop<Tail, Remove>
|
||||||
@ -191,7 +191,7 @@ type Drop<
|
|||||||
type FlatmapSplitWithDelemiters<
|
type FlatmapSplitWithDelemiters<
|
||||||
Inputs extends readonly string[],
|
Inputs extends readonly string[],
|
||||||
Delemiters extends readonly string[],
|
Delemiters extends readonly string[],
|
||||||
Acc extends string[] = []
|
Acc extends string[] = [],
|
||||||
> = Inputs extends [infer FirstInput, ...infer RestInputs]
|
> = Inputs extends [infer FirstInput, ...infer RestInputs]
|
||||||
? FirstInput extends string
|
? FirstInput extends string
|
||||||
? RestInputs extends readonly string[]
|
? RestInputs extends readonly string[]
|
||||||
@ -207,7 +207,7 @@ type FlatmapSplitWithDelemiters<
|
|||||||
type Split<
|
type Split<
|
||||||
Input extends string,
|
Input extends string,
|
||||||
Delimiter extends string,
|
Delimiter extends string,
|
||||||
Acc extends string[] = []
|
Acc extends string[] = [],
|
||||||
> = Input extends `${infer Prefix}${Delimiter}${infer Suffix}`
|
> = Input extends `${infer Prefix}${Delimiter}${infer Suffix}`
|
||||||
? Split<Suffix, Delimiter, [...Acc, Prefix]>
|
? Split<Suffix, Delimiter, [...Acc, Prefix]>
|
||||||
: [...Acc, Input];
|
: [...Acc, Input];
|
||||||
|
@ -244,7 +244,7 @@ export const withSourcePuppeteerURLIfNone = <T extends NonNullable<unknown>>(
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export const getSourcePuppeteerURLIfAvailable = <
|
export const getSourcePuppeteerURLIfAvailable = <
|
||||||
T extends NonNullable<unknown>
|
T extends NonNullable<unknown>,
|
||||||
>(
|
>(
|
||||||
object: T
|
object: T
|
||||||
): PuppeteerURL | undefined => {
|
): PuppeteerURL | undefined => {
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
import {Token, tokenize, TOKENS, stringify} from 'parsel-js';
|
import {Token, tokenize, TOKENS, stringify} from 'parsel-js';
|
||||||
|
|
||||||
export type CSSSelector = string;
|
export type CSSSelector = string;
|
||||||
export type PPseudoSelector = {
|
export interface PPseudoSelector {
|
||||||
name: string;
|
name: string;
|
||||||
value: string;
|
value: string;
|
||||||
};
|
}
|
||||||
export const enum PCombinator {
|
export const enum PCombinator {
|
||||||
Descendent = '>>>',
|
Descendent = '>>>',
|
||||||
Child = '>>>>',
|
Child = '>>>>',
|
||||||
|
@ -57,12 +57,12 @@ export const isSuitableNodeForTextMatching = (node: Node): boolean => {
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export type TextContent = {
|
export interface TextContent {
|
||||||
// Contains the full text of the node.
|
// Contains the full text of the node.
|
||||||
full: string;
|
full: string;
|
||||||
// Contains the text immediately beneath the node.
|
// Contains the text immediately beneath the node.
|
||||||
immediate: string[];
|
immediate: string[];
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps {@link Node}s to their computed {@link TextContent}.
|
* Maps {@link Node}s to their computed {@link TextContent}.
|
||||||
|
@ -46,12 +46,12 @@ import {PuppeteerNode} from './PuppeteerNode.js';
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export type ResolvedLaunchArgs = {
|
export interface ResolvedLaunchArgs {
|
||||||
isTempUserDataDir: boolean;
|
isTempUserDataDir: boolean;
|
||||||
userDataDir: string;
|
userDataDir: string;
|
||||||
executablePath: string;
|
executablePath: string;
|
||||||
args: string[];
|
args: string[];
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a launcher - a class that is able to create and launch a browser instance.
|
* Describes a launcher - a class that is able to create and launch a browser instance.
|
||||||
|
@ -85,7 +85,7 @@ export class Deferred<T> {
|
|||||||
static async race<R>(
|
static async race<R>(
|
||||||
awaitables: Array<Promise<R> | Deferred<R>>
|
awaitables: Array<Promise<R> | Deferred<R>>
|
||||||
): Promise<R> {
|
): Promise<R> {
|
||||||
const deferredWithTimeout: Set<Deferred<R>> = new Set();
|
const deferredWithTimeout = new Set<Deferred<R>>();
|
||||||
try {
|
try {
|
||||||
const promises = awaitables.map(value => {
|
const promises = awaitables.map(value => {
|
||||||
if (value instanceof Deferred) {
|
if (value instanceof Deferred) {
|
||||||
|
@ -14,6 +14,10 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
files: ['*.spec.ts'],
|
files: ['*.spec.ts'],
|
||||||
rules: {
|
rules: {
|
||||||
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{argsIgnorePattern: '^_', varsIgnorePattern: '^_'},
|
||||||
|
],
|
||||||
'no-restricted-syntax': [
|
'no-restricted-syntax': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
|
@ -583,9 +583,12 @@ describe('AriaQueryHandler', () => {
|
|||||||
});
|
});
|
||||||
await page.setContent(`<div aria-label='zombo'>anything</div>`);
|
await page.setContent(`<div aria-label='zombo'>anything</div>`);
|
||||||
expect(
|
expect(
|
||||||
await page.evaluate(x => {
|
await page.evaluate(
|
||||||
return x?.textContent;
|
x => {
|
||||||
}, await waitForSelector)
|
return x?.textContent;
|
||||||
|
},
|
||||||
|
await waitForSelector
|
||||||
|
)
|
||||||
).toBe('anything');
|
).toBe('anything');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ describe('Evaluation specs', function () {
|
|||||||
const {page} = await getTestState();
|
const {page} = await getTestState();
|
||||||
|
|
||||||
const result = await page.evaluate(() => {
|
const result = await page.evaluate(() => {
|
||||||
const a: {[x: string]: any} = {};
|
const a: Record<string, any> = {};
|
||||||
const b = {a};
|
const b = {a};
|
||||||
a['b'] = b;
|
a['b'] = b;
|
||||||
return a;
|
return a;
|
||||||
|
@ -92,14 +92,20 @@ const compareText = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const result = diffLines(expected, actual);
|
const result = diffLines(expected, actual);
|
||||||
const html = result.reduce((text, change) => {
|
const html = result.reduce(
|
||||||
text += change.added
|
(text, change) => {
|
||||||
? `<span class='ins'>${change.value}</span>`
|
text += change.added
|
||||||
: change.removed
|
? `<span class='ins'>${change.value}</span>`
|
||||||
? `<span class='del'>${change.value}</span>`
|
: change.removed
|
||||||
: change.value;
|
? `<span class='del'>${change.value}</span>`
|
||||||
return text;
|
: change.value;
|
||||||
}, `<link rel="stylesheet" href="file://${path.join(__dirname, 'diffstyle.css')}">`);
|
return text;
|
||||||
|
},
|
||||||
|
`<link rel="stylesheet" href="file://${path.join(
|
||||||
|
__dirname,
|
||||||
|
'diffstyle.css'
|
||||||
|
)}">`
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
diff: html,
|
diff: html,
|
||||||
ext: '.html',
|
ext: '.html',
|
||||||
|
@ -286,15 +286,18 @@ describe('headful tests', function () {
|
|||||||
|
|
||||||
// Navigate to the empty page and add an OOPIF iframe with at least one request.
|
// Navigate to the empty page and add an OOPIF iframe with at least one request.
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.evaluate((frameUrl: string) => {
|
await page.evaluate(
|
||||||
const frame = document.createElement('iframe');
|
(frameUrl: string) => {
|
||||||
frame.setAttribute('src', frameUrl);
|
const frame = document.createElement('iframe');
|
||||||
document.body.appendChild(frame);
|
frame.setAttribute('src', frameUrl);
|
||||||
return new Promise((x, y) => {
|
document.body.appendChild(frame);
|
||||||
frame.onload = x;
|
return new Promise((x, y) => {
|
||||||
frame.onerror = y;
|
frame.onload = x;
|
||||||
});
|
frame.onerror = y;
|
||||||
}, server.PREFIX.replace('localhost', 'oopifdomain') + '/one-style.html');
|
});
|
||||||
|
},
|
||||||
|
server.PREFIX.replace('localhost', 'oopifdomain') + '/one-style.html'
|
||||||
|
);
|
||||||
await page.waitForSelector('iframe');
|
await page.waitForSelector('iframe');
|
||||||
|
|
||||||
// Ensure we found the iframe session.
|
// Ensure we found the iframe session.
|
||||||
|
@ -66,7 +66,7 @@ describe('Keyboard', function () {
|
|||||||
return document.querySelector('textarea')!.value;
|
return document.querySelector('textarea')!.value;
|
||||||
})
|
})
|
||||||
).toBe('Hello World!');
|
).toBe('Hello World!');
|
||||||
for (let i = 0; i < 'World!'.length; i++) {
|
for (const _ of 'World!') {
|
||||||
page.keyboard.press('ArrowLeft');
|
page.keyboard.press('ArrowLeft');
|
||||||
}
|
}
|
||||||
await page.keyboard.type('inserted ');
|
await page.keyboard.type('inserted ');
|
||||||
@ -76,7 +76,7 @@ describe('Keyboard', function () {
|
|||||||
})
|
})
|
||||||
).toBe('Hello inserted World!');
|
).toBe('Hello inserted World!');
|
||||||
page.keyboard.down('Shift');
|
page.keyboard.down('Shift');
|
||||||
for (let i = 0; i < 'inserted '.length; i++) {
|
for (const _ of 'inserted ') {
|
||||||
page.keyboard.press('ArrowLeft');
|
page.keyboard.press('ArrowLeft');
|
||||||
}
|
}
|
||||||
page.keyboard.up('Shift');
|
page.keyboard.up('Shift');
|
||||||
@ -515,7 +515,7 @@ describe('Keyboard', function () {
|
|||||||
const [key, code, metaKey] = (await page.evaluate('result')) as [
|
const [key, code, metaKey] = (await page.evaluate('result')) as [
|
||||||
string,
|
string,
|
||||||
string,
|
string,
|
||||||
boolean
|
boolean,
|
||||||
];
|
];
|
||||||
if (isFirefox && os.platform() !== 'darwin') {
|
if (isFirefox && os.platform() !== 'darwin') {
|
||||||
expect(key).toBe('OS');
|
expect(key).toBe('OS');
|
||||||
|
@ -216,12 +216,12 @@ describeWithDebugLogs('OOPIF', function () {
|
|||||||
const frame = await framePromise;
|
const frame = await framePromise;
|
||||||
await frame.evaluate(() => {
|
await frame.evaluate(() => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
_test = 'Test 123!';
|
_test = 'Test 123!';
|
||||||
});
|
});
|
||||||
const result = await frame.evaluate(() => {
|
const result = await frame.evaluate(() => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
return window._test;
|
return window._test;
|
||||||
});
|
});
|
||||||
expect(result).toBe('Test 123!');
|
expect(result).toBe('Test 123!');
|
||||||
|
@ -1432,14 +1432,14 @@ describe('Page', function () {
|
|||||||
expect(
|
expect(
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore: userAgentData not yet in TypeScript DOM API
|
// @ts-expect-error: userAgentData not yet in TypeScript DOM API
|
||||||
return navigator.userAgentData.mobile;
|
return navigator.userAgentData.mobile;
|
||||||
})
|
})
|
||||||
).toBe(false);
|
).toBe(false);
|
||||||
|
|
||||||
const uaData = await page.evaluate(() => {
|
const uaData = await page.evaluate(() => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore: userAgentData not yet in TypeScript DOM API
|
// @ts-expect-error: userAgentData not yet in TypeScript DOM API
|
||||||
return navigator.userAgentData.getHighEntropyValues([
|
return navigator.userAgentData.getHighEntropyValues([
|
||||||
'architecture',
|
'architecture',
|
||||||
'model',
|
'model',
|
||||||
|
@ -715,9 +715,12 @@ describe('waittask specs', function () {
|
|||||||
const waitForSelector = page.waitForSelector('.zombo');
|
const waitForSelector = page.waitForSelector('.zombo');
|
||||||
await page.setContent(`<div class='zombo'>anything</div>`);
|
await page.setContent(`<div class='zombo'>anything</div>`);
|
||||||
expect(
|
expect(
|
||||||
await page.evaluate(x => {
|
await page.evaluate(
|
||||||
return x?.textContent;
|
x => {
|
||||||
}, await waitForSelector)
|
return x?.textContent;
|
||||||
|
},
|
||||||
|
await waitForSelector
|
||||||
|
)
|
||||||
).toBe('anything');
|
).toBe('anything');
|
||||||
});
|
});
|
||||||
it('should have correct stack trace for timeout', async () => {
|
it('should have correct stack trace for timeout', async () => {
|
||||||
@ -748,9 +751,12 @@ describe('waittask specs', function () {
|
|||||||
'//p[normalize-space(.)="hello world"]'
|
'//p[normalize-space(.)="hello world"]'
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
await page.evaluate(x => {
|
await page.evaluate(
|
||||||
return x?.textContent;
|
x => {
|
||||||
}, await waitForXPath)
|
return x?.textContent;
|
||||||
|
},
|
||||||
|
await waitForXPath
|
||||||
|
)
|
||||||
).toBe('hello world ');
|
).toBe('hello world ');
|
||||||
});
|
});
|
||||||
it('should respect timeout', async () => {
|
it('should respect timeout', async () => {
|
||||||
@ -836,9 +842,12 @@ describe('waittask specs', function () {
|
|||||||
const waitForXPath = page.waitForXPath('//*[@class="zombo"]');
|
const waitForXPath = page.waitForXPath('//*[@class="zombo"]');
|
||||||
await page.setContent(`<div class='zombo'>anything</div>`);
|
await page.setContent(`<div class='zombo'>anything</div>`);
|
||||||
expect(
|
expect(
|
||||||
await page.evaluate(x => {
|
await page.evaluate(
|
||||||
return x?.textContent;
|
x => {
|
||||||
}, await waitForXPath)
|
return x?.textContent;
|
||||||
|
},
|
||||||
|
await waitForXPath
|
||||||
|
)
|
||||||
).toBe('anything');
|
).toBe('anything');
|
||||||
});
|
});
|
||||||
it('should allow you to select a text node', async () => {
|
it('should allow you to select a text node', async () => {
|
||||||
@ -856,9 +865,12 @@ describe('waittask specs', function () {
|
|||||||
await page.setContent(`<div>some text</div>`);
|
await page.setContent(`<div>some text</div>`);
|
||||||
const waitForXPath = page.waitForXPath('/html/body/div');
|
const waitForXPath = page.waitForXPath('/html/body/div');
|
||||||
expect(
|
expect(
|
||||||
await page.evaluate(x => {
|
await page.evaluate(
|
||||||
return x?.textContent;
|
x => {
|
||||||
}, await waitForXPath)
|
return x?.textContent;
|
||||||
|
},
|
||||||
|
await waitForXPath
|
||||||
|
)
|
||||||
).toBe('some text');
|
).toBe('some text');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -491,7 +491,7 @@ export class MarkdownDocumenter {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
let needsComma = false;
|
let needsComma = false;
|
||||||
const visited: Set<string> = new Set();
|
const visited = new Set<string>();
|
||||||
for (const ref of refs) {
|
for (const ref of refs) {
|
||||||
if (visited.has(ref.text)) {
|
if (visited.has(ref.text)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -79,7 +79,7 @@ function customBDDInterface(suite: Mocha.Suite) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
context['describe'] = describe;
|
context['describe'] = describe;
|
||||||
|
|
||||||
function it(title: string, fn: Mocha.TestFunction, itOnly = false) {
|
function it(title: string, fn: Mocha.TestFunction, itOnly = false) {
|
||||||
@ -90,7 +90,7 @@ function customBDDInterface(suite: Mocha.Suite) {
|
|||||||
|
|
||||||
const describeOnly = Boolean(
|
const describeOnly = Boolean(
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
suite.parent?._onlySuites.find(child => {
|
suite.parent?._onlySuites.find(child => {
|
||||||
return child === suite;
|
return child === suite;
|
||||||
})
|
})
|
||||||
@ -119,7 +119,7 @@ function customBDDInterface(suite: Mocha.Suite) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
context.it = it;
|
context.it = it;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -40,21 +40,21 @@ export type TestSuiteFile = z.infer<typeof zTestSuiteFile>;
|
|||||||
|
|
||||||
export type TestResult = 'PASS' | 'FAIL' | 'TIMEOUT' | 'SKIP';
|
export type TestResult = 'PASS' | 'FAIL' | 'TIMEOUT' | 'SKIP';
|
||||||
|
|
||||||
export type TestExpectation = {
|
export interface TestExpectation {
|
||||||
testIdPattern: string;
|
testIdPattern: string;
|
||||||
platforms: NodeJS.Platform[];
|
platforms: NodeJS.Platform[];
|
||||||
parameters: string[];
|
parameters: string[];
|
||||||
expectations: TestResult[];
|
expectations: TestResult[];
|
||||||
};
|
}
|
||||||
|
|
||||||
export type MochaTestResult = {
|
export interface MochaTestResult {
|
||||||
fullTitle: string;
|
fullTitle: string;
|
||||||
title: string;
|
title: string;
|
||||||
file: string;
|
file: string;
|
||||||
err?: {code: string};
|
err?: {code: string};
|
||||||
};
|
}
|
||||||
|
|
||||||
export type MochaResults = {
|
export interface MochaResults {
|
||||||
stats: {tests: number};
|
stats: {tests: number};
|
||||||
pending: MochaTestResult[];
|
pending: MochaTestResult[];
|
||||||
passes: MochaTestResult[];
|
passes: MochaTestResult[];
|
||||||
@ -64,4 +64,4 @@ export type MochaResults = {
|
|||||||
parameters?: string[];
|
parameters?: string[];
|
||||||
platform?: string;
|
platform?: string;
|
||||||
date?: string;
|
date?: string;
|
||||||
};
|
}
|
||||||
|
@ -114,11 +114,11 @@ export function findEffectiveExpectationForTest(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RecommendedExpectation = {
|
export interface RecommendedExpectation {
|
||||||
expectation: TestExpectation;
|
expectation: TestExpectation;
|
||||||
action: 'remove' | 'add' | 'update';
|
action: 'remove' | 'add' | 'update';
|
||||||
basedOn?: TestExpectation;
|
basedOn?: TestExpectation;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function isWildCardPattern(testIdPattern: string): boolean {
|
export function isWildCardPattern(testIdPattern: string): boolean {
|
||||||
return testIdPattern.includes('*');
|
return testIdPattern.includes('*');
|
||||||
@ -132,7 +132,7 @@ export function getExpectationUpdates(
|
|||||||
parameters: string[];
|
parameters: string[];
|
||||||
}
|
}
|
||||||
): RecommendedExpectation[] {
|
): RecommendedExpectation[] {
|
||||||
const output: Map<string, RecommendedExpectation> = new Map();
|
const output = new Map<string, RecommendedExpectation>();
|
||||||
|
|
||||||
for (const pass of results.passes) {
|
for (const pass of results.passes) {
|
||||||
const expectationEntry = findEffectiveExpectationForTest(
|
const expectationEntry = findEffectiveExpectationForTest(
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const prettier = require('prettier');
|
const prettier = require('@prettier/sync');
|
||||||
|
|
||||||
const source = 'test/TestExpectations.json';
|
const source = 'test/TestExpectations.json';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user