|
|
|
|
@ -280,7 +280,7 @@ await context.close();
|
|
|
|
|
- [browserContext.clearCookies()](#browsercontextclearcookies)
|
|
|
|
|
- [browserContext.clearPermissions()](#browsercontextclearpermissions)
|
|
|
|
|
- [browserContext.close()](#browsercontextclose)
|
|
|
|
|
- [browserContext.cookies([...urls])](#browsercontextcookiesurls)
|
|
|
|
|
- [browserContext.cookies([urls])](#browsercontextcookiesurls)
|
|
|
|
|
- [browserContext.exposeFunction(name, playwrightFunction)](#browsercontextexposefunctionname-playwrightfunction)
|
|
|
|
|
- [browserContext.newPage()](#browsercontextnewpage)
|
|
|
|
|
- [browserContext.pages()](#browsercontextpages)
|
|
|
|
|
@ -365,8 +365,8 @@ will be closed.
|
|
|
|
|
|
|
|
|
|
> **NOTE** the default browser context cannot be closed.
|
|
|
|
|
|
|
|
|
|
#### browserContext.cookies([...urls])
|
|
|
|
|
- `...urls` <...[string]>
|
|
|
|
|
#### browserContext.cookies([urls])
|
|
|
|
|
- `urls` <[string]|[Array]<[string]>>
|
|
|
|
|
- returns: <[Promise]<[Array]<[Object]>>>
|
|
|
|
|
- `name` <[string]>
|
|
|
|
|
- `value` <[string]>
|
|
|
|
|
@ -653,7 +653,7 @@ page.removeListener('request', logRequest);
|
|
|
|
|
- [page.reload([options])](#pagereloadoptions)
|
|
|
|
|
- [page.route(url, handler)](#pagerouteurl-handler)
|
|
|
|
|
- [page.screenshot([options])](#pagescreenshotoptions)
|
|
|
|
|
- [page.select(selector, value[, options])](#pageselectselector-value-options)
|
|
|
|
|
- [page.select(selector, values[, options])](#pageselectselector-values-options)
|
|
|
|
|
- [page.setContent(html[, options])](#pagesetcontenthtml-options)
|
|
|
|
|
- [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout)
|
|
|
|
|
- [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout)
|
|
|
|
|
@ -907,6 +907,12 @@ To disable authentication, pass `null`.
|
|
|
|
|
- `selector` <[string]> A selector to search for checkbox or radio button to check. If there are multiple elements satisfying the selector, the first will be checked.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully checked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -926,20 +932,18 @@ Shortcut for [page.mainFrame().check(selector[, options])](#framecheckselector-o
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully clicked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
This method fetches an element with `selector`, scrolls it into view if needed, and then uses [page.mouse](#pagemouse) to click in the center of the element.
|
|
|
|
|
If there's no element matching `selector`, the method throws an error.
|
|
|
|
|
|
|
|
|
|
Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following:
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
const [response] = await Promise.all([
|
|
|
|
|
page.waitForNavigation(waitOptions),
|
|
|
|
|
page.click(selector, clickOptions),
|
|
|
|
|
]);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Shortcut for [page.mainFrame().click(selector[, options])](#frameclickselector-options).
|
|
|
|
|
|
|
|
|
|
@ -982,6 +986,12 @@ Browser-specific Coverage implementation, only available for Chromium atm. See [
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the double click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully double clicked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -1154,6 +1164,12 @@ const fs = require('fs');
|
|
|
|
|
- `value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom. Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully filled. The promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -1190,7 +1206,8 @@ Returns frame matching the specified criteria. Either `name` or `url` must be sp
|
|
|
|
|
#### page.goBack([options])
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -1203,7 +1220,8 @@ Navigate to the previous page in history.
|
|
|
|
|
#### page.goForward([options])
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -1217,7 +1235,8 @@ Navigate to the next page in history.
|
|
|
|
|
- `url` <[string]> URL to navigate page to. The url should include scheme, e.g. `https://`.
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -1350,7 +1369,8 @@ The `format` options are:
|
|
|
|
|
#### page.reload([options])
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -1403,14 +1423,20 @@ await browser.close();
|
|
|
|
|
|
|
|
|
|
> **NOTE** Screenshots take at least 1/6 second on Chromium OS X and Chromium Windows. See https://crbug.com/741689 for discussion.
|
|
|
|
|
|
|
|
|
|
#### page.select(selector, value[, options])
|
|
|
|
|
#### page.select(selector, values[, options])
|
|
|
|
|
- `selector` <[string]> A selector to query frame for.
|
|
|
|
|
- `value` <[string]|[ElementHandle]|[Object]|[Array]<[string]>|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
|
|
|
|
- `values` <[string]|[ElementHandle]|[Object]|[Array]<[string]>|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
|
|
|
|
- `value` <[string]> Matches by `option.value`.
|
|
|
|
|
- `label` <[string]> Matches by `option.label`.
|
|
|
|
|
- `index` <[number]> Matches by the index.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom. Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]<[Array]<[string]>>> An array of option values that have been successfully selected.
|
|
|
|
|
|
|
|
|
|
@ -1437,7 +1463,7 @@ Shortcut for [page.mainFrame().select()](#frameselectselector-values)
|
|
|
|
|
- `html` <[string]> HTML markup to assign to the page.
|
|
|
|
|
- `options` <[Object]> Parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds for resources to load, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider setting markup succeeded, defaults to `load`. Given an array of event strings, setting content is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider setting markup succeeded, defaults to `load`. Given an array of event strings, setting content is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `'load'` - consider setting content to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider setting content to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider setting content to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -1508,6 +1534,12 @@ Shortcut for [page.mainFrame().title()](#frametitle).
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the triple click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully triple clicked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -1526,6 +1558,12 @@ Shortcut for [page.mainFrame().tripleclick(selector[, options])](#frametriplecli
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom. Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]>
|
|
|
|
|
|
|
|
|
|
@ -1544,6 +1582,12 @@ Shortcut for [page.mainFrame().type(selector, text[, options])](#frametypeselect
|
|
|
|
|
- `selector` <[string]> A selector to search for uncheckbox to check. If there are multiple elements satisfying the selector, the first will be checked.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully unchecked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -1671,7 +1715,8 @@ Shortcut for [page.mainFrame().waitForFunction(pageFunction[, options[, ...args]
|
|
|
|
|
#### page.waitForLoadState([options])
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -1692,7 +1737,8 @@ Shortcut for [page.mainFrame().waitForLoadState([options])](#framewaitforloadsta
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -1814,7 +1860,7 @@ An example of getting text from an iframe element:
|
|
|
|
|
- [frame.isDetached()](#frameisdetached)
|
|
|
|
|
- [frame.name()](#framename)
|
|
|
|
|
- [frame.parentFrame()](#frameparentframe)
|
|
|
|
|
- [frame.select(selector, value[, options])](#frameselectselector-value-options)
|
|
|
|
|
- [frame.select(selector, values[, options])](#frameselectselector-values-options)
|
|
|
|
|
- [frame.setContent(html[, options])](#framesetcontenthtml-options)
|
|
|
|
|
- [frame.title()](#frametitle)
|
|
|
|
|
- [frame.tripleclick(selector[, options])](#frametripleclickselector-options)
|
|
|
|
|
@ -1895,6 +1941,12 @@ Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<s
|
|
|
|
|
- `selector` <[string]> A selector to search for checkbox to check. If there are multiple elements satisfying the selector, the first will be checked.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully checked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -1915,21 +1967,18 @@ If there's no element matching `selector`, the method throws an error.
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully clicked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
This method fetches an element with `selector`, scrolls it into view if needed, and then uses [page.mouse](#pagemouse) to click in the center of the element.
|
|
|
|
|
If there's no element matching `selector`, the method throws an error.
|
|
|
|
|
|
|
|
|
|
Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following:
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
const [response] = await Promise.all([
|
|
|
|
|
page.waitForNavigation(waitOptions),
|
|
|
|
|
frame.click(selector, clickOptions),
|
|
|
|
|
]);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### frame.content()
|
|
|
|
|
- returns: <[Promise]<[string]>>
|
|
|
|
|
|
|
|
|
|
@ -1945,6 +1994,12 @@ Gets the full HTML contents of the frame, including the doctype.
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the double click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully double clicked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -2017,6 +2072,12 @@ await resultHandle.dispose();
|
|
|
|
|
- `value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom. Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully filled. The promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -2050,7 +2111,8 @@ console.log(frame === contentFrame); // -> true
|
|
|
|
|
- `url` <[string]> URL to navigate frame to. The url should include scheme, e.g. `https://`.
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -2103,14 +2165,20 @@ If the name is empty, returns the id attribute instead.
|
|
|
|
|
#### frame.parentFrame()
|
|
|
|
|
- returns: <?[Frame]> Parent frame, if any. Detached frames and main frames return `null`.
|
|
|
|
|
|
|
|
|
|
#### frame.select(selector, value[, options])
|
|
|
|
|
#### frame.select(selector, values[, options])
|
|
|
|
|
- `selector` <[string]> A selector to query frame for.
|
|
|
|
|
- `value` <[string]|[ElementHandle]|[Object]|[Array]<[string]>|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
|
|
|
|
- `values` <[string]|[ElementHandle]|[Object]|[Array]<[string]>|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
|
|
|
|
- `value` <[string]> Matches by `option.value`.
|
|
|
|
|
- `label` <[string]> Matches by `option.label`.
|
|
|
|
|
- `index` <[number]> Matches by the index.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom. Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]<[Array]<[string]>>> An array of option values that have been successfully selected.
|
|
|
|
|
|
|
|
|
|
@ -2135,7 +2203,8 @@ frame.select('select#colors', { value: 'blue' }, { index: 2 }, 'red');
|
|
|
|
|
- `html` <[string]> HTML markup to assign to the page.
|
|
|
|
|
- `options` <[Object]> Parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds for resources to load, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider setting markup succeeded, defaults to `load`. Given an array of event strings, setting content is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider setting content to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider setting content to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider setting content to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -2155,6 +2224,12 @@ frame.select('select#colors', { value: 'blue' }, { index: 2 }, 'red');
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the triple click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully triple clicked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -2171,6 +2246,12 @@ Bear in mind that if the first or second click of the `tripleclick()` triggers a
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom. Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]>
|
|
|
|
|
|
|
|
|
|
@ -2187,6 +2268,12 @@ await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a
|
|
|
|
|
- `selector` <[string]> A selector to search for uncheckbox to check. If there are multiple elements satisfying the selector, the first will be checked.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully unchecked. The Promise will be rejected if there is no element matching `selector`.
|
|
|
|
|
|
|
|
|
|
@ -2292,7 +2379,8 @@ await page.waitForFunction(selector => !!document.querySelector(selector), {}, s
|
|
|
|
|
#### frame.waitForLoadState([options])
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -2311,7 +2399,8 @@ await frame.waitForLoadState(); // The promise resolves after navigation has fin
|
|
|
|
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
|
|
|
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultNavigationTimeout(timeout)](#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- `url` <[string]|[RegExp]|[Function]> URL string, URL regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
|
|
|
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|[Array]<"load"|"domcontentloaded"|"networkidle0"|"networkidle2">> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `load`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
@ -2363,15 +2452,15 @@ ElementHandle instances can be used as arguments in [`page.$eval()`](#pageevalse
|
|
|
|
|
- [elementHandle.click([options])](#elementhandleclickoptions)
|
|
|
|
|
- [elementHandle.contentFrame()](#elementhandlecontentframe)
|
|
|
|
|
- [elementHandle.dblclick([options])](#elementhandledblclickoptions)
|
|
|
|
|
- [elementHandle.fill(value)](#elementhandlefillvalue)
|
|
|
|
|
- [elementHandle.fill(value[, options])](#elementhandlefillvalue-options)
|
|
|
|
|
- [elementHandle.focus()](#elementhandlefocus)
|
|
|
|
|
- [elementHandle.hover([options])](#elementhandlehoveroptions)
|
|
|
|
|
- [elementHandle.ownerFrame()](#elementhandleownerframe)
|
|
|
|
|
- [elementHandle.press(key[, options])](#elementhandlepresskey-options)
|
|
|
|
|
- [elementHandle.screenshot([options])](#elementhandlescreenshotoptions)
|
|
|
|
|
- [elementHandle.scrollIntoViewIfNeeded()](#elementhandlescrollintoviewifneeded)
|
|
|
|
|
- [elementHandle.select(...values)](#elementhandleselectvalues)
|
|
|
|
|
- [elementHandle.setInputFiles(...files)](#elementhandlesetinputfilesfiles)
|
|
|
|
|
- [elementHandle.select(values[, options])](#elementhandleselectvalues-options)
|
|
|
|
|
- [elementHandle.setInputFiles(files)](#elementhandlesetinputfilesfiles)
|
|
|
|
|
- [elementHandle.toString()](#elementhandletostring)
|
|
|
|
|
- [elementHandle.tripleclick([options])](#elementhandletripleclickoptions)
|
|
|
|
|
- [elementHandle.type(text[, options])](#elementhandletypetext-options)
|
|
|
|
|
@ -2450,6 +2539,12 @@ This method returns the bounding box of the element (relative to the main frame)
|
|
|
|
|
#### elementHandle.check([options])
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element is successfully checked. Promise gets rejected if the operation fails.
|
|
|
|
|
|
|
|
|
|
@ -2465,6 +2560,12 @@ If element is not already checked, it scrolls it into view if needed, and then u
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element is successfully clicked. Promise gets rejected if the element is detached from DOM.
|
|
|
|
|
|
|
|
|
|
@ -2483,6 +2584,12 @@ If the element is detached from DOM, the method throws an error.
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the double click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element is successfully double clicked. Promise gets rejected if the element is detached from DOM.
|
|
|
|
|
|
|
|
|
|
@ -2493,8 +2600,16 @@ Bear in mind that if the first click of the `dblclick()` triggers a navigation e
|
|
|
|
|
|
|
|
|
|
> **NOTE** `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.
|
|
|
|
|
|
|
|
|
|
#### elementHandle.fill(value)
|
|
|
|
|
#### elementHandle.fill(value[, options])
|
|
|
|
|
- `value` <[string]> Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element is successfully filled.
|
|
|
|
|
|
|
|
|
|
This method focuses the element and triggers an `input` event after filling.
|
|
|
|
|
@ -2526,6 +2641,13 @@ If the element is detached from DOM, the method throws an error.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `text` <[string]> If specified, generates an input event with this text.
|
|
|
|
|
- `delay` <[number]> Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]>
|
|
|
|
|
|
|
|
|
|
Focuses the element, and then uses [`keyboard.down`](#keyboarddownkey-options) and [`keyboard.up`](#keyboardupkey).
|
|
|
|
|
@ -2553,11 +2675,19 @@ Throws when ```elementHandle``` does not point to an element [connected](https:/
|
|
|
|
|
|
|
|
|
|
> **NOTE** If javascript is disabled, element is scrolled into view even when already completely visible.
|
|
|
|
|
|
|
|
|
|
#### elementHandle.select(...values)
|
|
|
|
|
- `...values` <...[string]|[ElementHandle]|[Object]> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
|
|
|
|
#### elementHandle.select(values[, options])
|
|
|
|
|
- `values` <[string]|[ElementHandle]|[Object]|[Array]<[string]>|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
|
|
|
|
- `value` <[string]> Matches by `option.value`.
|
|
|
|
|
- `label` <[string]> Matches by `option.label`.
|
|
|
|
|
- `index` <[number]> Matches by the index.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]<[Array]<[string]>>> An array of option values that have been successfully selected.
|
|
|
|
|
|
|
|
|
|
Triggers a `change` and `input` event once all the provided options have been selected.
|
|
|
|
|
@ -2577,8 +2707,8 @@ handle.select('red', 'green', 'blue');
|
|
|
|
|
handle.select({ value: 'blue' }, { index: 2 }, 'red');
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### elementHandle.setInputFiles(...files)
|
|
|
|
|
- `...files` <...[string]|[Object]> Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the [current working directory](https://nodejs.org/api/process.html#process_process_cwd).
|
|
|
|
|
#### elementHandle.setInputFiles(files)
|
|
|
|
|
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
|
|
|
|
- `name` <[string]> <[File]> name
|
|
|
|
|
- `type` <[string]> <[File]> type
|
|
|
|
|
- `data` <[string]> Base64-encoded data
|
|
|
|
|
@ -2586,6 +2716,8 @@ handle.select({ value: 'blue' }, { index: 2 }, 'red');
|
|
|
|
|
|
|
|
|
|
This method expects `elementHandle` to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
|
|
|
|
|
|
|
|
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). For empty array, clears the selected files.
|
|
|
|
|
|
|
|
|
|
#### elementHandle.toString()
|
|
|
|
|
- returns: <[string]>
|
|
|
|
|
|
|
|
|
|
@ -2598,6 +2730,12 @@ This method expects `elementHandle` to point to an [input element](https://devel
|
|
|
|
|
- y <[number]>
|
|
|
|
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the triple click, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element is successfully triple clicked. Promise gets rejected if the element is detached from DOM.
|
|
|
|
|
|
|
|
|
|
@ -2612,6 +2750,13 @@ Bear in mind that if the first or second click of the `tripleclick()` triggers a
|
|
|
|
|
- `text` <[string]> A text to type into a focused element.
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]>
|
|
|
|
|
|
|
|
|
|
Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
|
|
|
|
|
@ -2633,6 +2778,12 @@ await elementHandle.press('Enter');
|
|
|
|
|
#### elementHandle.uncheck([options])
|
|
|
|
|
- `options` <[Object]>
|
|
|
|
|
- `waitFor` <[boolean]> Whether to wait for the element to stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`.
|
|
|
|
|
- `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"> When to consider navigation succeeded, defaults to `commit`. Events can be either:
|
|
|
|
|
- `'commit'` - navigation is committed, new url is displayed in the browser address bar.
|
|
|
|
|
- `'load'` - consider navigation to be finished when the `load` event is fired.
|
|
|
|
|
- `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
|
|
|
|
- `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
|
|
|
|
- `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
|
|
|
|
- `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods.
|
|
|
|
|
- returns: <[Promise]> Promise which resolves when the element is successfully unchecked. Promise gets rejected if the operation fails.
|
|
|
|
|
|
|
|
|
|
@ -3681,7 +3832,7 @@ const backgroundPage = await backroundPageTarget.page();
|
|
|
|
|
- [browserContext.clearCookies()](#browsercontextclearcookies)
|
|
|
|
|
- [browserContext.clearPermissions()](#browsercontextclearpermissions)
|
|
|
|
|
- [browserContext.close()](#browsercontextclose)
|
|
|
|
|
- [browserContext.cookies([...urls])](#browsercontextcookiesurls)
|
|
|
|
|
- [browserContext.cookies([urls])](#browsercontextcookiesurls)
|
|
|
|
|
- [browserContext.exposeFunction(name, playwrightFunction)](#browsercontextexposefunctionname-playwrightfunction)
|
|
|
|
|
- [browserContext.newPage()](#browsercontextnewpage)
|
|
|
|
|
- [browserContext.pages()](#browsercontextpages)
|
|
|
|
|
|