Skip to content

Commit

Permalink
fix: add Page.getDefaultTimeout getter (#8903)
Browse files Browse the repository at this point in the history
Closes #8901
  • Loading branch information
GuillaumeGomez committed Sep 5, 2022
1 parent 8e1c8b9 commit 3240095
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/api/puppeteer.page.getdefaulttimeout.md
@@ -0,0 +1,19 @@
---
sidebar_label: Page.getDefaultTimeout
---

# Page.getDefaultTimeout() method

**Signature:**

```typescript
class Page {
getDefaultTimeout(): number;
}
```

**Returns:**

number

Maximum time in milliseconds.
1 change: 1 addition & 0 deletions docs/api/puppeteer.page.md
Expand Up @@ -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) | | |
Expand Down
7 changes: 7 additions & 0 deletions src/common/Page.ts
Expand Up @@ -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`.
Expand Down

0 comments on commit 3240095

Please sign in to comment.