Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add Page.getDefaultTimeout getter #8903

Merged
merged 2 commits into from Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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