chore: remove docs warnings (#10959)

This commit is contained in:
Nikolay Vitkov 2023-09-21 11:09:27 +02:00 committed by GitHub
parent 9cfc195794
commit 0b7f0216e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 67 additions and 118 deletions

View File

@ -71,7 +71,7 @@ await browser2.close();
| [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves the process running. | | [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves the process running. |
| [isConnected()](./puppeteer.browser.isconnected.md) | | Whether Puppeteer is connected to this [browser](./puppeteer.browser.md). | | [isConnected()](./puppeteer.browser.isconnected.md) | | Whether Puppeteer is connected to this [browser](./puppeteer.browser.md). |
| [newPage()](./puppeteer.browser.newpage.md) | | Creates a new [page](./puppeteer.page.md) in the [default browser context](./puppeteer.browser.defaultbrowsercontext.md). | | [newPage()](./puppeteer.browser.newpage.md) | | Creates a new [page](./puppeteer.page.md) in the [default browser context](./puppeteer.browser.defaultbrowsercontext.md). |
| [pages()](./puppeteer.browser.pages.md) | | <p>Gets a list of all open [pages](./puppeteer.page.md) inside this .</p><p>If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md).</p> | | [pages()](./puppeteer.browser.pages.md) | | <p>Gets a list of all open [pages](./puppeteer.page.md) inside this [Browser](./puppeteer.browser.md).</p><p>If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md).</p> |
| [process()](./puppeteer.browser.process.md) | | Gets the associated [ChildProcess](https://nodejs.org/api/child_process.html#class-childprocess). | | [process()](./puppeteer.browser.process.md) | | Gets the associated [ChildProcess](https://nodejs.org/api/child_process.html#class-childprocess). |
| [target()](./puppeteer.browser.target.md) | | Gets the [target](./puppeteer.target.md) associated with the [default browser context](./puppeteer.browser.defaultbrowsercontext.md)). | | [target()](./puppeteer.browser.target.md) | | Gets the [target](./puppeteer.target.md) associated with the [default browser context](./puppeteer.browser.defaultbrowsercontext.md)). |
| [targets()](./puppeteer.browser.targets.md) | | <p>Gets all active [targets](./puppeteer.target.md).</p><p>In case of multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [targets](./puppeteer.target.md) in all [browser contexts](./puppeteer.browsercontext.md).</p> | | [targets()](./puppeteer.browser.targets.md) | | <p>Gets all active [targets](./puppeteer.target.md).</p><p>In case of multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [targets](./puppeteer.target.md) in all [browser contexts](./puppeteer.browsercontext.md).</p> |

View File

@ -4,7 +4,7 @@ sidebar_label: Browser.pages
# Browser.pages() method # Browser.pages() method
Gets a list of all open [pages](./puppeteer.page.md) inside this . Gets a list of all open [pages](./puppeteer.page.md) inside this [Browser](./puppeteer.browser.md).
If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md). If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md).

View File

@ -10,7 +10,7 @@ Brings page to front (activates tab).
```typescript ```typescript
class Page { class Page {
bringToFront(): Promise<void>; abstract bringToFront(): Promise<void>;
} }
``` ```

View File

@ -10,7 +10,7 @@ Get the browser the page belongs to.
```typescript ```typescript
class Page { class Page {
browser(): Browser; abstract browser(): Browser;
} }
``` ```

View File

@ -10,7 +10,7 @@ Get the browser context that the page belongs to.
```typescript ```typescript
class Page { class Page {
browserContext(): BrowserContext; abstract browserContext(): BrowserContext;
} }
``` ```

View File

@ -8,7 +8,7 @@ sidebar_label: Page.close
```typescript ```typescript
class Page { class Page {
close(options?: {runBeforeUnload?: boolean}): Promise<void>; abstract close(options?: {runBeforeUnload?: boolean}): Promise<void>;
} }
``` ```

View File

@ -16,7 +16,7 @@ The function is invoked after the document was created but before any of its scr
```typescript ```typescript
class Page { class Page {
evaluateOnNewDocument< abstract evaluateOnNewDocument<
Params extends unknown[], Params extends unknown[],
Func extends (...args: Params) => unknown = (...args: Params) => unknown, Func extends (...args: Params) => unknown = (...args: Params) => unknown,
>( >(

View File

@ -10,7 +10,7 @@ An array of all frames attached to the page.
```typescript ```typescript
class Page { class Page {
frames(): Frame[]; abstract frames(): Frame[];
} }
``` ```

View File

@ -10,7 +10,7 @@ Maximum time in milliseconds.
```typescript ```typescript
class Page { class Page {
getDefaultTimeout(): number; abstract getDefaultTimeout(): number;
} }
``` ```

View File

@ -10,7 +10,7 @@ Indicates that the page has been closed.
```typescript ```typescript
class Page { class Page {
isClosed(): boolean; abstract isClosed(): boolean;
} }
``` ```

View File

@ -10,7 +10,7 @@ The page's main frame.
```typescript ```typescript
class Page { class Page {
mainFrame(): Frame; abstract mainFrame(): Frame;
} }
``` ```

View File

@ -10,7 +10,7 @@ Generates a PDF of the page with the `print` CSS media type.
```typescript ```typescript
class Page { class Page {
pdf(options?: PDFOptions): Promise<Buffer>; abstract pdf(options?: PDFOptions): Promise<Buffer>;
} }
``` ```

View File

@ -10,7 +10,7 @@ Reloads the page.
```typescript ```typescript
class Page { class Page {
reload(options?: WaitForOptions): Promise<HTTPResponse | null>; abstract reload(options?: WaitForOptions): Promise<HTTPResponse | null>;
} }
``` ```

View File

@ -10,7 +10,9 @@ Removes script that injected into page by Page.evaluateOnNewDocument.
```typescript ```typescript
class Page { class Page {
removeScriptToEvaluateOnNewDocument(identifier: string): Promise<void>; abstract removeScriptToEvaluateOnNewDocument(
identifier: string
): Promise<void>;
} }
``` ```

View File

@ -10,7 +10,7 @@ Captures screenshot of the current page.
```typescript ```typescript
class Page { class Page {
screenshot( abstract screenshot(
options: ScreenshotOptions & { options: ScreenshotOptions & {
encoding: 'base64'; encoding: 'base64';
} }

View File

@ -8,7 +8,7 @@ sidebar_label: Page.screenshot_1
```typescript ```typescript
class Page { class Page {
screenshot( abstract screenshot(
options?: ScreenshotOptions & { options?: ScreenshotOptions & {
encoding?: 'binary'; encoding?: 'binary';
} }

View File

@ -8,7 +8,7 @@ sidebar_label: Page.screenshot_2
```typescript ```typescript
class Page { class Page {
screenshot(options?: ScreenshotOptions): Promise<Buffer | string>; abstract screenshot(options?: ScreenshotOptions): Promise<Buffer | string>;
} }
``` ```

View File

@ -22,7 +22,7 @@ This setting will change the default maximum navigation time for the following m
```typescript ```typescript
class Page { class Page {
setDefaultNavigationTimeout(timeout: number): void; abstract setDefaultNavigationTimeout(timeout: number): void;
} }
``` ```

View File

@ -8,7 +8,7 @@ sidebar_label: Page.setDefaultTimeout
```typescript ```typescript
class Page { class Page {
setDefaultTimeout(timeout: number): void; abstract setDefaultTimeout(timeout: number): void;
} }
``` ```

View File

@ -12,7 +12,7 @@ In the case of multiple pages in a single browser, each page can have its own vi
```typescript ```typescript
class Page { class Page {
setViewport(viewport: Viewport): Promise<void>; abstract setViewport(viewport: Viewport): Promise<void>;
} }
``` ```

View File

@ -10,7 +10,7 @@ Current page viewport settings.
```typescript ```typescript
class Page { class Page {
viewport(): Viewport | null; abstract viewport(): Viewport | null;
} }
``` ```

View File

@ -8,7 +8,7 @@ sidebar_label: Page.waitForNetworkIdle
```typescript ```typescript
class Page { class Page {
waitForNetworkIdle(options?: { abstract waitForNetworkIdle(options?: {
idleTime?: number; idleTime?: number;
timeout?: number; timeout?: number;
}): Promise<void>; }): Promise<void>;

View File

@ -8,7 +8,7 @@ sidebar_label: Page.waitForRequest
```typescript ```typescript
class Page { class Page {
waitForRequest( abstract waitForRequest(
urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>), urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>),
options?: { options?: {
timeout?: number; timeout?: number;

View File

@ -8,7 +8,7 @@ sidebar_label: Page.waitForResponse
```typescript ```typescript
class Page { class Page {
waitForResponse( abstract waitForResponse(
urlOrPredicate: urlOrPredicate:
| string | string
| ((res: HTTPResponse) => boolean | Promise<boolean>), | ((res: HTTPResponse) => boolean | Promise<boolean>),

View File

@ -415,7 +415,7 @@ export abstract class Browser extends EventEmitter<BrowserEvents> {
} }
/** /**
* Gets a list of all open {@link Page | pages} inside this {@link browser}. * Gets a list of all open {@link Page | pages} inside this {@link Browser}.
* *
* If there ar multiple {@link BrowserContext | browser contexts}, this * If there ar multiple {@link BrowserContext | browser contexts}, this
* returns all {@link Page | pages} in all * returns all {@link Page | pages} in all

View File

@ -682,16 +682,12 @@ export abstract class Page extends EventEmitter<PageEvents> {
/** /**
* Get the browser the page belongs to. * Get the browser the page belongs to.
*/ */
browser(): Browser { abstract browser(): Browser;
throw new Error('Not implemented');
}
/** /**
* Get the browser context that the page belongs to. * Get the browser context that the page belongs to.
*/ */
browserContext(): BrowserContext { abstract browserContext(): BrowserContext;
throw new Error('Not implemented');
}
/** /**
* The page's main frame. * The page's main frame.
@ -699,9 +695,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
* @remarks * @remarks
* Page is guaranteed to have a main frame which persists during navigations. * Page is guaranteed to have a main frame which persists during navigations.
*/ */
mainFrame(): Frame { abstract mainFrame(): Frame;
throw new Error('Not implemented');
}
/** /**
* Creates a Chrome Devtools Protocol session attached to the page. * Creates a Chrome Devtools Protocol session attached to the page.
@ -713,9 +707,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
/** /**
* {@inheritDoc Keyboard} * {@inheritDoc Keyboard}
*/ */
get keyboard(): Keyboard { abstract get keyboard(): Keyboard;
throw new Error('Not implemented');
}
/** /**
* {@inheritDoc Touchscreen} * {@inheritDoc Touchscreen}
@ -727,30 +719,22 @@ export abstract class Page extends EventEmitter<PageEvents> {
/** /**
* {@inheritDoc Coverage} * {@inheritDoc Coverage}
*/ */
get coverage(): Coverage { abstract get coverage(): Coverage;
throw new Error('Not implemented');
}
/** /**
* {@inheritDoc Tracing} * {@inheritDoc Tracing}
*/ */
get tracing(): Tracing { abstract get tracing(): Tracing;
throw new Error('Not implemented');
}
/** /**
* {@inheritDoc Accessibility} * {@inheritDoc Accessibility}
*/ */
get accessibility(): Accessibility { abstract get accessibility(): Accessibility;
throw new Error('Not implemented');
}
/** /**
* An array of all frames attached to the page. * An array of all frames attached to the page.
*/ */
frames(): Frame[] { abstract frames(): Frame[];
throw new Error('Not implemented');
}
/** /**
* All of the dedicated {@link * All of the dedicated {@link
@ -890,25 +874,17 @@ export abstract class Page extends EventEmitter<PageEvents> {
* - {@link Page.waitForNavigation | page.waitForNavigation(options)} * - {@link Page.waitForNavigation | page.waitForNavigation(options)}
* @param timeout - Maximum navigation time in milliseconds. * @param timeout - Maximum navigation time in milliseconds.
*/ */
setDefaultNavigationTimeout(timeout: number): void; abstract setDefaultNavigationTimeout(timeout: number): void;
setDefaultNavigationTimeout(): void {
throw new Error('Not implemented');
}
/** /**
* @param timeout - Maximum time in milliseconds. * @param timeout - Maximum time in milliseconds.
*/ */
setDefaultTimeout(timeout: number): void; abstract setDefaultTimeout(timeout: number): void;
setDefaultTimeout(): void {
throw new Error('Not implemented');
}
/** /**
* Maximum time in milliseconds. * Maximum time in milliseconds.
*/ */
getDefaultTimeout(): number { abstract getDefaultTimeout(): number;
throw new Error('Not implemented');
}
/** /**
* Creates a locator for the provided selector. See {@link Locator} for * Creates a locator for the provided selector. See {@link Locator} for
@ -1579,10 +1555,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
* multiple redirects, the navigation will resolve with the response of the * multiple redirects, the navigation will resolve with the response of the
* last redirect. * last redirect.
*/ */
async reload(options?: WaitForOptions): Promise<HTTPResponse | null>; abstract reload(options?: WaitForOptions): Promise<HTTPResponse | null>;
async reload(): Promise<HTTPResponse | null> {
throw new Error('Not implemented');
}
/** /**
* Waits for the page to navigate to a new URL or to reload. It is useful when * Waits for the page to navigate to a new URL or to reload. It is useful when
@ -1640,13 +1613,10 @@ export abstract class Page extends EventEmitter<PageEvents> {
* `0` to disable the timeout. The default value can be changed by using the * `0` to disable the timeout. The default value can be changed by using the
* {@link Page.setDefaultTimeout} method. * {@link Page.setDefaultTimeout} method.
*/ */
async waitForRequest( abstract waitForRequest(
urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>), urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>),
options?: {timeout?: number} options?: {timeout?: number}
): Promise<HTTPRequest>; ): Promise<HTTPRequest>;
async waitForRequest(): Promise<HTTPRequest> {
throw new Error('Not implemented');
}
/** /**
* @param urlOrPredicate - A URL or predicate to wait for. * @param urlOrPredicate - A URL or predicate to wait for.
@ -1675,27 +1645,21 @@ export abstract class Page extends EventEmitter<PageEvents> {
* pass `0` to disable the timeout. The default value can be changed by using * pass `0` to disable the timeout. The default value can be changed by using
* the {@link Page.setDefaultTimeout} method. * the {@link Page.setDefaultTimeout} method.
*/ */
async waitForResponse( abstract waitForResponse(
urlOrPredicate: urlOrPredicate:
| string | string
| ((res: HTTPResponse) => boolean | Promise<boolean>), | ((res: HTTPResponse) => boolean | Promise<boolean>),
options?: {timeout?: number} options?: {timeout?: number}
): Promise<HTTPResponse>; ): Promise<HTTPResponse>;
async waitForResponse(): Promise<HTTPResponse> {
throw new Error('Not implemented');
}
/** /**
* @param options - Optional waiting parameters * @param options - Optional waiting parameters
* @returns Promise which resolves when network is idle * @returns Promise which resolves when network is idle
*/ */
async waitForNetworkIdle(options?: { abstract waitForNetworkIdle(options?: {
idleTime?: number; idleTime?: number;
timeout?: number; timeout?: number;
}): Promise<void>; }): Promise<void>;
async waitForNetworkIdle(): Promise<void> {
throw new Error('Not implemented');
}
/** /**
* @internal * @internal
@ -1841,9 +1805,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
/** /**
* Brings page to front (activates tab). * Brings page to front (activates tab).
*/ */
async bringToFront(): Promise<void> { abstract bringToFront(): Promise<void>;
throw new Error('Not implemented');
}
/** /**
* Emulates a given device's metrics and user agent. * Emulates a given device's metrics and user agent.
@ -2121,10 +2083,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
* NOTE: in certain cases, setting viewport will reload the page in order to * NOTE: in certain cases, setting viewport will reload the page in order to
* set the isMobile or hasTouch properties. * set the isMobile or hasTouch properties.
*/ */
async setViewport(viewport: Viewport): Promise<void>; abstract setViewport(viewport: Viewport): Promise<void>;
async setViewport(): Promise<void> {
throw new Error('Not implemented');
}
/** /**
* Current page viewport settings. * Current page viewport settings.
@ -2147,9 +2106,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
* - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to * - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to
* `false`. * `false`.
*/ */
viewport(): Viewport | null { abstract viewport(): Viewport | null;
throw new Error('Not implemented');
}
/** /**
* Evaluates a function in the page's context and returns the result. * Evaluates a function in the page's context and returns the result.
@ -2244,26 +2201,22 @@ export abstract class Page extends EventEmitter<PageEvents> {
* await page.evaluateOnNewDocument(preloadFile); * await page.evaluateOnNewDocument(preloadFile);
* ``` * ```
*/ */
async evaluateOnNewDocument< abstract 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
): Promise<NewDocumentScriptEvaluation>; ): Promise<NewDocumentScriptEvaluation>;
async evaluateOnNewDocument(): Promise<NewDocumentScriptEvaluation> {
throw new Error('Not implemented');
}
/** /**
* Removes script that injected into page by Page.evaluateOnNewDocument. * Removes script that injected into page by Page.evaluateOnNewDocument.
* *
* @param identifier - script identifier * @param identifier - script identifier
*/ */
async removeScriptToEvaluateOnNewDocument(identifier: string): Promise<void>; abstract removeScriptToEvaluateOnNewDocument(
async removeScriptToEvaluateOnNewDocument(): Promise<void> { identifier: string
throw new Error('Not implemented'); ): Promise<void>;
}
/** /**
* Toggles ignoring cache for each request based on the enabled state. By * Toggles ignoring cache for each request based on the enabled state. By
@ -2338,16 +2291,13 @@ export abstract class Page extends EventEmitter<PageEvents> {
* @returns Promise which resolves to buffer or a base64 string (depending on * @returns Promise which resolves to buffer or a base64 string (depending on
* the value of `encoding`) with captured screenshot. * the value of `encoding`) with captured screenshot.
*/ */
screenshot( abstract screenshot(
options: ScreenshotOptions & {encoding: 'base64'} options: ScreenshotOptions & {encoding: 'base64'}
): Promise<string>; ): Promise<string>;
screenshot( abstract screenshot(
options?: ScreenshotOptions & {encoding?: 'binary'} options?: ScreenshotOptions & {encoding?: 'binary'}
): Promise<Buffer>; ): Promise<Buffer>;
async screenshot(options?: ScreenshotOptions): Promise<Buffer | string>; abstract screenshot(options?: ScreenshotOptions): Promise<Buffer | string>;
async screenshot(): Promise<Buffer | string> {
throw new Error('Not implemented');
}
/** /**
* @internal * @internal
@ -2427,10 +2377,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
/** /**
* {@inheritDoc Page.createPDFStream} * {@inheritDoc Page.createPDFStream}
*/ */
async pdf(options?: PDFOptions): Promise<Buffer>; abstract pdf(options?: PDFOptions): Promise<Buffer>;
async pdf(): Promise<Buffer> {
throw new Error('Not implemented');
}
/** /**
* The page's title * The page's title
@ -2442,25 +2389,18 @@ export abstract class Page extends EventEmitter<PageEvents> {
return await this.mainFrame().title(); return await this.mainFrame().title();
} }
async close(options?: {runBeforeUnload?: boolean}): Promise<void>; abstract close(options?: {runBeforeUnload?: boolean}): Promise<void>;
async close(): Promise<void> {
throw new Error('Not implemented');
}
/** /**
* Indicates that the page has been closed. * Indicates that the page has been closed.
* @returns * @returns
*/ */
isClosed(): boolean { abstract isClosed(): boolean;
throw new Error('Not implemented');
}
/** /**
* {@inheritDoc Mouse} * {@inheritDoc Mouse}
*/ */
get mouse(): Mouse { abstract get mouse(): Mouse;
throw new Error('Not implemented');
}
/** /**
* This method fetches an element with `selector`, scrolls it into view if * This method fetches an element with `selector`, scrolls it into view if

View File

@ -76,12 +76,18 @@ interface JavascriptEnabledState {
active: boolean; active: boolean;
} }
interface ClientProvider { /**
* @internal
*/
export interface ClientProvider {
clients(): CDPSession[]; clients(): CDPSession[];
registerState(state: EmulatedState<any>): void; registerState(state: EmulatedState<any>): void;
} }
class EmulatedState<T extends {active: boolean}> { /**
* @internal
*/
export class EmulatedState<T extends {active: boolean}> {
#state: T; #state: T;
#clientProvider: ClientProvider; #clientProvider: ClientProvider;
#updater: (client: CDPSession, state: T) => Promise<void>; #updater: (client: CDPSession, state: T) => Promise<void>;

View File

@ -84,7 +84,7 @@ export class DisposableStack {
* *
* @param value - The resource to add. `null` and `undefined` will not be added, * @param value - The resource to add. `null` and `undefined` will not be added,
* but will be returned. * but will be returned.
* @returns The provided {@link value}. * @returns The provided `value`.
*/ */
use<T extends Disposable | null | undefined>(value: T): T { use<T extends Disposable | null | undefined>(value: T): T {
if (value) { if (value) {
@ -99,7 +99,7 @@ export class DisposableStack {
* @param value - The value to add. * @param value - The value to add.
* @param onDispose - The callback to use in place of a `[disposeSymbol]()` * @param onDispose - The callback to use in place of a `[disposeSymbol]()`
* method. Will be invoked with `value` as the first parameter. * method. Will be invoked with `value` as the first parameter.
* @returns The provided {@link value}. * @returns The provided `value`.
*/ */
adopt<T>(value: T, onDispose: (value: T) => void): T { adopt<T>(value: T, onDispose: (value: T) => void): T {
this.#stack.push({ this.#stack.push({

View File

@ -19,3 +19,4 @@ export * from './DebuggableDeferred.js';
export * from './Deferred.js'; export * from './Deferred.js';
export * from './ErrorLike.js'; export * from './ErrorLike.js';
export * from './AsyncIterableUtil.js'; export * from './AsyncIterableUtil.js';
export * from './disposable.js';