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
-`viewport` <[Object]> Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.
198
198
-`width` <[number]> page width in pixels.
199
199
-`height` <[number]> page height in pixels.
200
200
-`deviceScaleFactor` <[number]> Specify device scale factor (can be thought of as dpr). Defaults to `1`.
201
201
-`isMobile` <[boolean]> Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox.
202
-
-`userAgent` <?[string]> Specific user agent to use in this context.
203
-
-`javaScriptEnabled` <?[boolean]> Whether or not to enable or disable JavaScript in the context. Defaults to true.
202
+
-`userAgent` <[string]> Specific user agent to use in this context.
203
+
-`javaScriptEnabled` <[boolean]> Whether or not to enable or disable JavaScript in the context. Defaults to true.
204
204
-`timezoneId` <?[string]> Changes the timezone of the context. See [ICU’s `metaZones.txt`](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.
205
205
-`geolocation` <[Object]>
206
206
-`latitude` <[number]> Latitude between -90 and 90.
@@ -341,10 +341,13 @@ An example of overriding `Math.random` before the page loads:
341
341
```js
342
342
// preload.js
343
343
Math.random= () =>42;
344
+
```
344
345
345
-
// In your playwright script, assuming the preload.js file is in same folder
// In your playwright script, assuming the preload.js file is in same folder.
348
+
awaitbrowserContext.addInitScript({
349
+
path:'preload.js'
350
+
});
348
351
```
349
352
350
353
> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript(script[, ...args])](#browsercontextaddinitscriptscript-args) and [page.addInitScript(script[, ...args])](#pageaddinitscriptscript-args) is not defined.
@@ -391,7 +394,7 @@ If URLs are specified, only cookies that affect those URLs are returned.
> **NOTE** Consider using [browserContext.setPermissions](#browsercontextsetpermissions-permissions) to grant permissions for the page to read its geolocation.
533
+
> **NOTE** Consider using [browserContext.setPermissions](#browsercontextsetpermissions-permissions) to grant permissions for the browser context pages to read its geolocation.
-`wsEndpoint` <?[string]> A browser websocket endpoint to connect to.
3784
-
-`slowMo` <[number]> Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
3756
+
-`wsEndpoint` <[string]> A browser websocket endpoint to connect to.
3757
+
-`slowMo` <?[number]> Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0.
3785
3758
- returns: <[Promise]<[Browser]>>
3786
3759
3787
3760
This methods attaches Playwright to an existing browser instance.
@@ -3842,9 +3815,9 @@ try {
3842
3815
#### browserType.launch([options])
3843
3816
-`options` <[Object]> Set of configurable options to set on the browser. Can have the following fields:
3844
3817
-`headless` <[boolean]> Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.
3845
-
-`executablePath` <[string]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). **BEWARE**: Playwright is only [guaranteed to work](https://github.com/Microsoft/playwright/#q-why-doesnt-playwright-vxxx-work-with-chromium-vyyy) with the bundled Chromium, Firefox or WebKit, use at your own risk.
3818
+
-`executablePath` <[string]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). Note that Playwright [only works](https://github.com/Microsoft/playwright/#q-why-doesnt-playwright-vxxx-work-with-chromium-vyyy) with the bundled Chromium, Firefox or WebKit, use at your own risk.
3846
3819
-`args` <[Array]<[string]>> Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).
3847
-
-`ignoreDefaultArgs` <[boolean]|[Array]<[string]>> If `true`, then do not use [`browserType.defaultArgs()`](#browsertypedefaultargsoptions). If an array is given, then filter out the given default arguments. Dangerous option; use with care. Defaults to `false`.
3820
+
-`ignoreDefaultArgs` <[boolean]|[Array]<[string]>> If `true`, Playwright does not pass its own configurations args and only uses the ones from `args`. If an array is given, then filters out the given default arguments. Dangerous option; use with care. Defaults to `false`.
3848
3821
-`handleSIGINT` <[boolean]> Close the browser process on Ctrl-C. Defaults to `true`.
3849
3822
-`handleSIGTERM` <[boolean]> Close the browser process on SIGTERM. Defaults to `true`.
3850
3823
-`handleSIGHUP` <[boolean]> Close the browser process on SIGHUP. Defaults to `true`.
@@ -3871,7 +3844,7 @@ const browser = await chromium.launch({ // Or 'firefox' or 'webkit'.
3871
3844
>
3872
3845
> See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.
-`userDataDir` <[string]> Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for [Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile).
3876
3849
-`options` <[Object]> Set of configurable options to set on the browser. Can have the following fields:
3877
3850
-`headless` <[boolean]> Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.
@@ -3887,7 +3860,7 @@ const browser = await chromium.launch({ // Or 'firefox' or 'webkit'.
3887
3860
-`devtools` <[boolean]> **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
3888
3861
- returns: <[Promise]<[BrowserContext]>> Promise which resolves to the browser app instance.
3889
3862
3890
-
Launches browser instance that uses persistent storage located at `userDataDir`. If `userDataDir` is not specified, temporary folder is created for the persistent storage. That folder is deleted when browser closes.
3863
+
Launches browser instance that uses persistent storage located at `userDataDir`.
3891
3864
3892
3865
#### browserType.launchServer([options])
3893
3866
-`options` <[Object]> Set of configurable options to set on the browser. Can have the following fields:
0 commit comments