diff --git a/docs/api/puppeteer.page.getdefaulttimeout.md b/docs/api/puppeteer.page.getdefaulttimeout.md new file mode 100644 index 00000000000..a44029aaee4 --- /dev/null +++ b/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. diff --git a/docs/api/puppeteer.page.md b/docs/api/puppeteer.page.md index f6d63edbcdb..b3f47b2f801 100644 --- a/docs/api/puppeteer.page.md +++ b/docs/api/puppeteer.page.md @@ -108,6 +108,7 @@ page.off('request', logRequest); | [exposeFunction(name, pptrFunction)](./puppeteer.page.exposefunction.md) | |
The method adds a function called name
on the page's window
object. When called, the function executes puppeteerFunction
in node.js and returns a Promise
which resolves to the return value of puppeteerFunction
.
If the puppeteerFunction returns a Promise
, it will be awaited.
:::note
Functions installed via page.exposeFunction
survive navigations.
:::note
| | [focus(selector)](./puppeteer.page.focus.md) | | This method fetches an element withselector
and focuses it. If there's no element matching selector
, 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) | | |
diff --git a/src/common/Page.ts b/src/common/Page.ts
index 0391891dc11..e97517d3544 100644
--- a/src/common/Page.ts
+++ b/src/common/Page.ts
@@ -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`.