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. |
| [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). |
| [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). |
| [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> |

View File

@ -4,7 +4,7 @@ sidebar_label: Browser.pages
# 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).

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ sidebar_label: Page.close
```typescript
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
class Page {
evaluateOnNewDocument<
abstract evaluateOnNewDocument<
Params extends 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
class Page {
frames(): Frame[];
abstract frames(): Frame[];
}
```

View File

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

View File

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

View File

@ -10,7 +10,7 @@ The page's main frame.
```typescript
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
class Page {
pdf(options?: PDFOptions): Promise<Buffer>;
abstract pdf(options?: PDFOptions): Promise<Buffer>;
}
```

View File

@ -10,7 +10,7 @@ Reloads the page.
```typescript
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
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
class Page {
screenshot(
abstract screenshot(
options: ScreenshotOptions & {
encoding: 'base64';
}

View File

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

View File

@ -8,7 +8,7 @@ sidebar_label: Page.screenshot_2
```typescript
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
class Page {
setDefaultNavigationTimeout(timeout: number): void;
abstract setDefaultNavigationTimeout(timeout: number): void;
}
```

View File

@ -8,7 +8,7 @@ sidebar_label: Page.setDefaultTimeout
```typescript
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
class Page {
setViewport(viewport: Viewport): Promise<void>;
abstract setViewport(viewport: Viewport): Promise<void>;
}
```

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ sidebar_label: Page.waitForResponse
```typescript
class Page {
waitForResponse(
abstract waitForResponse(
urlOrPredicate:
| string
| ((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
* 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.
*/
browser(): Browser {
throw new Error('Not implemented');
}
abstract browser(): Browser;
/**
* Get the browser context that the page belongs to.
*/
browserContext(): BrowserContext {
throw new Error('Not implemented');
}
abstract browserContext(): BrowserContext;
/**
* The page's main frame.
@ -699,9 +695,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
* @remarks
* Page is guaranteed to have a main frame which persists during navigations.
*/
mainFrame(): Frame {
throw new Error('Not implemented');
}
abstract mainFrame(): Frame;
/**
* Creates a Chrome Devtools Protocol session attached to the page.
@ -713,9 +707,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
/**
* {@inheritDoc Keyboard}
*/
get keyboard(): Keyboard {
throw new Error('Not implemented');
}
abstract get keyboard(): Keyboard;
/**
* {@inheritDoc Touchscreen}
@ -727,30 +719,22 @@ export abstract class Page extends EventEmitter<PageEvents> {
/**
* {@inheritDoc Coverage}
*/
get coverage(): Coverage {
throw new Error('Not implemented');
}
abstract get coverage(): Coverage;
/**
* {@inheritDoc Tracing}
*/
get tracing(): Tracing {
throw new Error('Not implemented');
}
abstract get tracing(): Tracing;
/**
* {@inheritDoc Accessibility}
*/
get accessibility(): Accessibility {
throw new Error('Not implemented');
}
abstract get accessibility(): Accessibility;
/**
* An array of all frames attached to the page.
*/
frames(): Frame[] {
throw new Error('Not implemented');
}
abstract frames(): Frame[];
/**
* All of the dedicated {@link
@ -890,25 +874,17 @@ export abstract class Page extends EventEmitter<PageEvents> {
* - {@link Page.waitForNavigation | page.waitForNavigation(options)}
* @param timeout - Maximum navigation time in milliseconds.
*/
setDefaultNavigationTimeout(timeout: number): void;
setDefaultNavigationTimeout(): void {
throw new Error('Not implemented');
}
abstract setDefaultNavigationTimeout(timeout: number): void;
/**
* @param timeout - Maximum time in milliseconds.
*/
setDefaultTimeout(timeout: number): void;
setDefaultTimeout(): void {
throw new Error('Not implemented');
}
abstract setDefaultTimeout(timeout: number): void;
/**
* Maximum time in milliseconds.
*/
getDefaultTimeout(): number {
throw new Error('Not implemented');
}
abstract getDefaultTimeout(): number;
/**
* 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
* last redirect.
*/
async reload(options?: WaitForOptions): Promise<HTTPResponse | null>;
async reload(): Promise<HTTPResponse | null> {
throw new Error('Not implemented');
}
abstract reload(options?: WaitForOptions): Promise<HTTPResponse | null>;
/**
* 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
* {@link Page.setDefaultTimeout} method.
*/
async waitForRequest(
abstract waitForRequest(
urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>),
options?: {timeout?: number}
): Promise<HTTPRequest>;
async waitForRequest(): Promise<HTTPRequest> {
throw new Error('Not implemented');
}
/**
* @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
* the {@link Page.setDefaultTimeout} method.
*/
async waitForResponse(
abstract waitForResponse(
urlOrPredicate:
| string
| ((res: HTTPResponse) => boolean | Promise<boolean>),
options?: {timeout?: number}
): Promise<HTTPResponse>;
async waitForResponse(): Promise<HTTPResponse> {
throw new Error('Not implemented');
}
/**
* @param options - Optional waiting parameters
* @returns Promise which resolves when network is idle
*/
async waitForNetworkIdle(options?: {
abstract waitForNetworkIdle(options?: {
idleTime?: number;
timeout?: number;
}): Promise<void>;
async waitForNetworkIdle(): Promise<void> {
throw new Error('Not implemented');
}
/**
* @internal
@ -1841,9 +1805,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
/**
* Brings page to front (activates tab).
*/
async bringToFront(): Promise<void> {
throw new Error('Not implemented');
}
abstract bringToFront(): Promise<void>;
/**
* 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
* set the isMobile or hasTouch properties.
*/
async setViewport(viewport: Viewport): Promise<void>;
async setViewport(): Promise<void> {
throw new Error('Not implemented');
}
abstract setViewport(viewport: Viewport): Promise<void>;
/**
* 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
* `false`.
*/
viewport(): Viewport | null {
throw new Error('Not implemented');
}
abstract viewport(): Viewport | null;
/**
* 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);
* ```
*/
async evaluateOnNewDocument<
abstract evaluateOnNewDocument<
Params extends unknown[],
Func extends (...args: Params) => unknown = (...args: Params) => unknown,
>(
pageFunction: Func | string,
...args: Params
): Promise<NewDocumentScriptEvaluation>;
async evaluateOnNewDocument(): Promise<NewDocumentScriptEvaluation> {
throw new Error('Not implemented');
}
/**
* Removes script that injected into page by Page.evaluateOnNewDocument.
*
* @param identifier - script identifier
*/
async removeScriptToEvaluateOnNewDocument(identifier: string): Promise<void>;
async removeScriptToEvaluateOnNewDocument(): Promise<void> {
throw new Error('Not implemented');
}
abstract removeScriptToEvaluateOnNewDocument(
identifier: string
): Promise<void>;
/**
* 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
* the value of `encoding`) with captured screenshot.
*/
screenshot(
abstract screenshot(
options: ScreenshotOptions & {encoding: 'base64'}
): Promise<string>;
screenshot(
abstract screenshot(
options?: ScreenshotOptions & {encoding?: 'binary'}
): Promise<Buffer>;
async screenshot(options?: ScreenshotOptions): Promise<Buffer | string>;
async screenshot(): Promise<Buffer | string> {
throw new Error('Not implemented');
}
abstract screenshot(options?: ScreenshotOptions): Promise<Buffer | string>;
/**
* @internal
@ -2427,10 +2377,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
/**
* {@inheritDoc Page.createPDFStream}
*/
async pdf(options?: PDFOptions): Promise<Buffer>;
async pdf(): Promise<Buffer> {
throw new Error('Not implemented');
}
abstract pdf(options?: PDFOptions): Promise<Buffer>;
/**
* The page's title
@ -2442,25 +2389,18 @@ export abstract class Page extends EventEmitter<PageEvents> {
return await this.mainFrame().title();
}
async close(options?: {runBeforeUnload?: boolean}): Promise<void>;
async close(): Promise<void> {
throw new Error('Not implemented');
}
abstract close(options?: {runBeforeUnload?: boolean}): Promise<void>;
/**
* Indicates that the page has been closed.
* @returns
*/
isClosed(): boolean {
throw new Error('Not implemented');
}
abstract isClosed(): boolean;
/**
* {@inheritDoc Mouse}
*/
get mouse(): Mouse {
throw new Error('Not implemented');
}
abstract get mouse(): Mouse;
/**
* This method fetches an element with `selector`, scrolls it into view if

View File

@ -76,12 +76,18 @@ interface JavascriptEnabledState {
active: boolean;
}
interface ClientProvider {
/**
* @internal
*/
export interface ClientProvider {
clients(): CDPSession[];
registerState(state: EmulatedState<any>): void;
}
class EmulatedState<T extends {active: boolean}> {
/**
* @internal
*/
export class EmulatedState<T extends {active: boolean}> {
#state: T;
#clientProvider: ClientProvider;
#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,
* but will be returned.
* @returns The provided {@link value}.
* @returns The provided `value`.
*/
use<T extends Disposable | null | undefined>(value: T): T {
if (value) {
@ -99,7 +99,7 @@ export class DisposableStack {
* @param value - The value to add.
* @param onDispose - The callback to use in place of a `[disposeSymbol]()`
* 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 {
this.#stack.push({

View File

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