mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs: clarify the viewport() behavior (#11442)
This commit is contained in:
parent
54b0bcbc46
commit
bbff323edf
@ -15,8 +15,8 @@ export interface BrowserConnectOptions
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description | Default |
|
||||
| ----------------- | --------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -------------------- |
|
||||
| defaultViewport | <code>optional</code> | [Viewport](./puppeteer.viewport.md) \| null | Sets the viewport for each page. | |
|
||||
| ----------------- | --------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------- | --------------------------- |
|
||||
| defaultViewport | <code>optional</code> | [Viewport](./puppeteer.viewport.md) \| null | Sets the viewport for each page. | '{width: 800, height: 600}' |
|
||||
| ignoreHTTPSErrors | <code>optional</code> | boolean | Whether to ignore HTTPS errors during navigation. | <code>false</code> |
|
||||
| protocolTimeout | <code>optional</code> | number | Timeout setting for individual protocol (CDP) calls. | <code>180_000</code> |
|
||||
| slowMo | <code>optional</code> | number | Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. | |
|
||||
|
@ -151,7 +151,7 @@ page.off('request', logRequest);
|
||||
| [title()](./puppeteer.page.title.md) | | The page's title |
|
||||
| [type(selector, text, options)](./puppeteer.page.type.md) | | <p>Sends a <code>keydown</code>, <code>keypress/input</code>, and <code>keyup</code> event for each character in the text.</p><p>To press a special key, like <code>Control</code> or <code>ArrowDown</code>, use [Keyboard.press()](./puppeteer.keyboard.press.md).</p> |
|
||||
| [url()](./puppeteer.page.url.md) | | The page's URL. |
|
||||
| [viewport()](./puppeteer.page.viewport.md) | | Current page viewport settings. |
|
||||
| [viewport()](./puppeteer.page.viewport.md) | | <p>Returns the current page viewport settings without checking the actual page viewport.</p><p>This is either the viewport set with the previous [Page.setViewport()](./puppeteer.page.setviewport.md) call or the default viewport set via [BrowserConnectOptions.defaultViewport](./puppeteer.browserconnectoptions.defaultviewport.md).</p> |
|
||||
| [waitForDevicePrompt(options)](./puppeteer.page.waitfordeviceprompt.md) | | <p>This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth.</p><p>:::caution</p><p>This must be called before the device request is made. It will not return a currently active device prompt.</p><p>:::</p> |
|
||||
| [waitForFileChooser(options)](./puppeteer.page.waitforfilechooser.md) | | <p>This method is typically coupled with an action that triggers file choosing.</p><p>:::caution</p><p>This must be called before the file chooser is launched. It will not return a currently active file chooser.</p><p>:::</p> |
|
||||
| [waitForFrame(urlOrPredicate, options)](./puppeteer.page.waitforframe.md) | | Waits for a frame matching the given conditions to appear. |
|
||||
|
@ -4,7 +4,9 @@ sidebar_label: Page.viewport
|
||||
|
||||
# Page.viewport() method
|
||||
|
||||
Current page viewport settings.
|
||||
Returns the current page viewport settings without checking the actual page viewport.
|
||||
|
||||
This is either the viewport set with the previous [Page.setViewport()](./puppeteer.page.setviewport.md) call or the default viewport set via [BrowserConnectOptions.defaultViewport](./puppeteer.browserconnectoptions.defaultviewport.md).
|
||||
|
||||
#### Signature:
|
||||
|
||||
|
@ -2292,7 +2292,12 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
||||
abstract setViewport(viewport: Viewport): Promise<void>;
|
||||
|
||||
/**
|
||||
* Current page viewport settings.
|
||||
* Returns the current page viewport settings without checking the actual page
|
||||
* viewport.
|
||||
*
|
||||
* This is either the viewport set with the previous {@link Page.setViewport}
|
||||
* call or the default viewport set via
|
||||
* {@link BrowserConnectOptions.defaultViewport}.
|
||||
*/
|
||||
abstract viewport(): Viewport | null;
|
||||
|
||||
|
@ -40,6 +40,8 @@ export interface BrowserConnectOptions {
|
||||
ignoreHTTPSErrors?: boolean;
|
||||
/**
|
||||
* Sets the viewport for each page.
|
||||
*
|
||||
* @defaultValue '\{width: 800, height: 600\}'
|
||||
*/
|
||||
defaultViewport?: Viewport | null;
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user