You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/api.md
+25-25
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ This object can be used to launch or connect to Chromium, returning instances of
71
71
#### playwright.devices
72
72
- returns: <[Object]>
73
73
74
-
Returns a list of devices to be used with [`browser.newContext(options)`](#browsernewcontextoptions) or [`browser.newPage(options)`](#browsernewpageoptions). Actual list of devices can be found in [src/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/deviceDescriptors.ts).
74
+
Returns a list of devices to be used with [`browser.newContext([options])`](#browsernewcontextoptions) or [`browser.newPage([options])`](#browsernewpageoptions). Actual list of devices can be found in [src/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/deviceDescriptors.ts).
75
75
76
76
```js
77
77
const { webkit, devices } =require('playwright');
@@ -145,14 +145,14 @@ const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.
145
145
})();
146
146
```
147
147
148
-
See [ChromiumBrowser], [FirefoxBrowser] and [WebKitBrowser] for browser-specific features. Note that [browserType.connect(options)](#browsertypeconnectoptions) and [browserType.launch(options)](#browsertypelaunchoptions) always return a specific browser instance, based on the browser being connected to or launched.
148
+
See [ChromiumBrowser], [FirefoxBrowser] and [WebKitBrowser] for browser-specific features. Note that [browserType.connect(options)](#browsertypeconnectoptions) and [browserType.launch([options])](#browsertypelaunchoptions) always return a specific browser instance, based on the browser being connected to or launched.
-`selector` <[string]> A selector to query page for.
1140
1140
-`value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
1141
1141
-`options` <[Object]>
@@ -1150,7 +1150,7 @@ If there's no text `<input>`, `<textarea>` or `[contenteditable]` element matchi
1150
1150
1151
1151
Shortcut for [page.mainFrame().fill()](#framefillselector-value)
1152
1152
1153
-
#### page.focus(selector, options)
1153
+
#### page.focus(selector[, options])
1154
1154
-`selector` <[string]> A selector of an element to focus. If there are multiple elements satisfying the selector, the first will be focused.
1155
1155
-`options` <[Object]>
1156
1156
-`waitFor` <[boolean]> Whether to wait for the element to be present in the dom. Defaults to `true`.
@@ -1216,7 +1216,7 @@ Navigate to the next page in history.
1216
1216
1217
1217
> **NOTE** Headless mode doesn't support navigation to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
1218
1218
1219
-
Shortcut for [page.mainFrame().goto(url, options)](#framegotourl-options)
1219
+
Shortcut for [page.mainFrame().goto(url[, options])](#framegotourl-options)
1220
1220
1221
1221
#### page.hover(selector[, options])
1222
1222
-`selector` <[string]> A selector to search for element to hover. If there are multiple elements satisfying the selector, the first will be hovered.
@@ -1381,7 +1381,7 @@ await browser.close();
1381
1381
1382
1382
> **NOTE** Screenshots take at least 1/6 second on Chromium OS X and Chromium Windows. See https://crbug.com/741689 for discussion.
1383
1383
1384
-
#### page.select(selector, value, options)
1384
+
#### page.select(selector, value[, options])
1385
1385
-`selector` <[string]> A selector to query frame for.
1386
1386
-`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.
Shortcut for [page.mainFrame().select()](#frameselectselector-values)
1413
1413
1414
1414
#### page.setCacheEnabled([enabled])
1415
-
-`enabled` <[boolean]> sets the `enabled` state of the cache.
1415
+
-`enabled` <[boolean]> sets the `enabled` state of the cache. Defaults to `true`.
1416
1416
- returns: <[Promise]>
1417
1417
1418
1418
Toggles ignoring cache for each request based on the enabled state. By default, caching is enabled.
@@ -1468,7 +1468,7 @@ The extra HTTP headers will be sent with every request the page initiates.
1468
1468
-`height` <[number]> page height in pixels. **required**
1469
1469
- returns: <[Promise]>
1470
1470
1471
-
In the case of multiple pages in a single browser, each page can have its own viewport size. However, [browser.newContext(options)](#browsernewcontextoptions) allows to set viewport size (and more) for all pages in the context at once.
1471
+
In the case of multiple pages in a single browser, each page can have its own viewport size. However, [browser.newContext([options])](#browsernewcontextoptions) allows to set viewport size (and more) for all pages in the context at once.
1472
1472
1473
1473
`page.setViewportSize` will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport size before navigating to the page.
1474
1474
@@ -1800,15 +1800,15 @@ An example of getting text from an iframe element:
This method focuses the element and triggers an `input` event after filling.
2037
2037
If there's no text `<input>`, `<textarea>` or `[contenteditable]` element matching `selector`, the method throws an error.
2038
2038
2039
-
#### frame.focus(selector, options)
2039
+
#### frame.focus(selector[, options])
2040
2040
-`selector` <[string]> A selector of an element to focus. If there are multiple elements satisfying the selector, the first will be focused.
2041
2041
-`options` <[Object]>
2042
2042
-`waitFor` <[boolean]> Whether to wait for the element to be present in the dom. Defaults to `true`.
@@ -2116,7 +2116,7 @@ If the name is empty, returns the id attribute instead.
2116
2116
#### frame.parentFrame()
2117
2117
- returns: <?[Frame]> Parent frame, if any. Detached frames and main frames return `null`.
2118
2118
2119
-
#### frame.select(selector, value, options)
2119
+
#### frame.select(selector, value[, options])
2120
2120
-`selector` <[string]> A selector to query frame for.
2121
2121
-`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.
2122
2122
-`value` <[string]> Matches by `option.value`.
@@ -3488,7 +3488,7 @@ This methods attaches Playwright to an existing browser instance.
3488
3488
#### browserType.devices
3489
3489
- returns: <[Object]>
3490
3490
3491
-
Returns a list of devices to be used with [`browser.newContext(options)`](#browsernewcontextoptions) and [`browser.newPage(options)`](#browsernewpageoptions). Actual list of devices can be found in [src/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/deviceDescriptors.ts).
3491
+
Returns a list of devices to be used with [`browser.newContext([options])`](#browsernewcontextoptions) and [`browser.newPage([options])`](#browsernewpageoptions). Actual list of devices can be found in [src/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/deviceDescriptors.ts).
0 commit comments