fix: add Page.getDefaultTimeout getter (#8903)

Closes #8901
This commit is contained in:
Guillaume Gomez 2022-09-05 19:43:39 +02:00 committed by GitHub
parent 8e1c8b9be6
commit 32400954c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,19 @@
---
sidebar_label: Page.getDefaultTimeout
---
# Page.getDefaultTimeout() method
**Signature:**
```typescript
class Page {
getDefaultTimeout(): number;
}
```
**Returns:**
number
Maximum time in milliseconds.

View File

@ -108,6 +108,7 @@ page.off('request', logRequest);
| [exposeFunction(name, pptrFunction)](./puppeteer.page.exposefunction.md) | | <p>The method adds a function called <code>name</code> on the page's <code>window</code> object. When called, the function executes <code>puppeteerFunction</code> in node.js and returns a <code>Promise</code> which resolves to the return value of <code>puppeteerFunction</code>.</p><p>If the puppeteerFunction returns a <code>Promise</code>, it will be awaited.</p><p>:::note</p><p>Functions installed via <code>page.exposeFunction</code> survive navigations.</p><p>:::note</p> |
| [focus(selector)](./puppeteer.page.focus.md) | | This method fetches an element with <code>selector</code> and focuses it. If there's no element matching <code>selector</code>, the method throws an error. |
| [frames()](./puppeteer.page.frames.md) | | |
| [getDefaultTimeout()](./puppeteer.page.getdefaulttimeout.md) | | |
| [goBack(options)](./puppeteer.page.goback.md) | | This method navigate to the previous page in history. |
| [goForward(options)](./puppeteer.page.goforward.md) | | This method navigate to the next page in history. |
| [goto(url, options)](./puppeteer.page.goto.md) | | |

View File

@ -1042,6 +1042,13 @@ export class Page extends EventEmitter {
this.#timeoutSettings.setDefaultTimeout(timeout);
}
/**
* @returns Maximum time in milliseconds.
*/
getDefaultTimeout(): number {
return this.#timeoutSettings.timeout();
}
/**
* Runs `document.querySelector` within the page. If no element matches the
* selector, the return value resolves to `null`.