Skip to content

Commit e67d897

Browse files
authored
chore: update docs to cover python specifics (#4960)
1 parent e990a80 commit e67d897

15 files changed

+168
-98
lines changed

docs/src/api/class-browsercontext.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ await browserContext.addCookies([cookieObject1, cookieObject2]);
5858

5959
### param: BrowserContext.addCookies.cookies
6060
- `cookies` <[Array]<[Object]>>
61-
- `name` <[string]> **required**
62-
- `value` <[string]> **required**
61+
- `name` <[string]>
62+
- `value` <[string]>
6363
- `url` <[string]> either url or domain / path are required. Optional.
6464
- `domain` <[string]> either url or domain / path are required Optional.
6565
- `path` <[string]> either url or domain / path are required Optional.
@@ -399,10 +399,9 @@ await browserContext.setGeolocation({latitude: 59.95, longitude: 30.31667});
399399
pages to read its geolocation.
400400

401401
### param: BrowserContext.setGeolocation.geolocation
402-
* langs: js
403402
- `geolocation` <[null]|[Object]>
404-
- `latitude` <[float]> Latitude between -90 and 90. **required**
405-
- `longitude` <[float]> Longitude between -180 and 180. **required**
403+
- `latitude` <[float]> Latitude between -90 and 90.
404+
- `longitude` <[float]> Longitude between -180 and 180.
406405
- `accuracy` <[float]> Non-negative accuracy value. Defaults to `0`.
407406

408407
## async method: BrowserContext.setHTTPCredentials
@@ -412,8 +411,8 @@ Create a new browser context instead.
412411

413412
### param: BrowserContext.setHTTPCredentials.httpCredentials
414413
- `httpCredentials` <[null]|[Object]>
415-
- `username` <[string]> **required**
416-
- `password` <[string]> **required**
414+
- `username` <[string]>
415+
- `password` <[string]>
417416

418417
## async method: BrowserContext.setOffline
419418

docs/src/api/class-browsertype.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This methods attaches Playwright to an existing browser instance.
2323

2424
### param: BrowserType.connect.params
2525
- `params` <[Object]>
26-
- `wsEndpoint` <[string]> A browser websocket endpoint to connect to. **required**
26+
- `wsEndpoint` <[string]> A browser websocket endpoint to connect to.
2727
- `slowMo` <[float]> Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0.
2828
- `logger` <[Logger]> Logger sink for Playwright logging. Optional.
2929
- `timeout` <[float]> Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.

docs/src/api/class-chromiumbrowser.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# class: ChromiumBrowser
2-
* extends: [Browser]
32
* langs: js
3+
* extends: [Browser]
44

55
Chromium-specific features including Tracing, service worker support, etc. You can use [`method:
66
ChromiumBrowser.startTracing`] and [`method: ChromiumBrowser.stopTracing`] to create a trace file which can be

docs/src/api/class-firefoxbrowser.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# class: FirefoxBrowser
2+
* langs: js
23
* extends: [Browser]
34

45
Firefox browser instance does not expose Firefox-specific features.

docs/src/api/class-page.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,7 @@ const frame = page.frame({ url: /.*domain.*/ });
872872
```
873873

874874
### param: Page.frame.frameSelector
875+
* langs: js
875876
- `frameSelector` <[string]|[Object]>
876877
- `name` <[string]> Frame name specified in the `iframe`'s `name` attribute. Optional.
877878
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.
@@ -1467,8 +1468,8 @@ await page.goto('https://example.com');
14671468

14681469
### param: Page.setViewportSize.viewportSize
14691470
- `viewportSize` <[Object]>
1470-
- `width` <[int]> page width in pixels. **required**
1471-
- `height` <[int]> page height in pixels. **required**
1471+
- `width` <[int]> page width in pixels.
1472+
- `height` <[int]> page height in pixels.
14721473

14731474
## async method: Page.tap
14741475

docs/src/api/class-request.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ If request gets a 'redirect' response, the request is successfully finished with
1515
request is issued to a redirected url.
1616

1717
## method: Request.failure
18+
* langs: js
1819
- returns: <[null]|[Object]>
1920
- `errorText` <[string]> Human-readable error message, e.g. `'net::ERR_FAILED'`.
2021

docs/src/api/class-response.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
Returns the buffer with response body.
99

1010
## async method: Response.finished
11+
* langs: js
1112
- returns: <[null]|[Error]>
1213

1314
Waits for this response to finish, returns failure error if request failed.

docs/src/api/class-selectors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Name that is used in selectors as a prefix, e.g. `{name: 'foo'}` enables `foo=my
4949
contain `[a-zA-Z0-9_]` characters.
5050

5151
### param: Selectors.register.script
52+
* langs: js
5253
- `script` <[function]|[string]|[Object]>
5354
- `path` <[path]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
5455
- `content` <[string]> Raw script content. Optional.

docs/src/api/class-webkitbrowser.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# class: WebKitBrowser
2+
* langs: js
23
* extends: [Browser]
34

45
WebKit browser instance does not expose WebKit-specific features.

docs/src/api/params.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ Defaults to `left`.
6868

6969
## input-files
7070
- `files` <[path]|[Array]<[path]>|[Object]|[Array]<[Object]>>
71-
- `name` <[string]> [File] name **required**
72-
- `mimeType` <[string]> [File] type **required**
73-
- `buffer` <[Buffer]> File content **required**
71+
- `name` <[string]> [File] name
72+
- `mimeType` <[string]> [File] type
73+
- `buffer` <[Buffer]> File content
7474

7575
## input-down-up-delay
7676
- `delay` <[float]>
@@ -101,8 +101,8 @@ Defaults to `'visible'`. Can be either:
101101
## context-option-storage-state
102102
- `storageState` <[path]|[Object]>
103103
- `cookies` <[Array]<[Object]>> Optional cookies to set for context
104-
- `name` <[string]> **required**
105-
- `value` <[string]> **required**
104+
- `name` <[string]>
105+
- `value` <[string]>
106106
- `url` <[string]> Optional either url or domain / path are required
107107
- `domain` <[string]> Optional either url or domain / path are required
108108
- `path` <[string]> Optional either url or domain / path are required
@@ -135,12 +135,27 @@ Whether to ignore HTTPS errors during navigation. Defaults to `false`.
135135
Toggles bypassing page's Content-Security-Policy.
136136

137137
## context-option-viewport
138+
* langs: js
138139
- `viewport` <[null]|[Object]>
139140
- `width` <[int]> page width in pixels.
140141
- `height` <[int]> page height in pixels.
141142

142143
Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.
143144

145+
## python-context-option-viewport
146+
* langs: python
147+
- `viewport` <[null]|[Object]>
148+
- `width` <[int]> page width in pixels.
149+
- `height` <[int]> page height in pixels.
150+
151+
Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.
152+
153+
## python-context-option-no-viewport
154+
* langs: python
155+
- `noViewport` <[boolean]>
156+
157+
Disables the default viewport.
158+
144159
## context-option-useragent
145160
- `userAgent` <[string]>
146161

@@ -233,6 +248,7 @@ Logger sink for Playwright logging.
233248
**DEPRECATED** Use [`option: recordVideo`] instead.
234249

235250
## context-option-recordhar
251+
* langs: js
236252
- `recordHar` <[Object]>
237253
- `omitContent` <[boolean]> Optional setting to control whether to omit request content from the HAR. Defaults to
238254
`false`.
@@ -242,7 +258,20 @@ Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all
242258
specified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`] for the HAR to be
243259
saved.
244260

261+
## python-context-option-recordhar-omit-content
262+
* langs: python
263+
- `record_har_omit_content` <[boolean]>
264+
265+
Optional setting to control whether to omit request content from the HAR. Defaults to `false`.
266+
267+
## python-context-option-recordhar-path
268+
* langs: python
269+
- `record_har_path` <[path]>
270+
271+
Path on the filesystem to write the HAR file to.
272+
245273
## context-option-recordvideo
274+
* langs: js
246275
- `recordVideo` <[Object]>
247276
- `dir` <[path]> Path to the directory to put videos into.
248277
- `size` <[Object]> Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport`.
@@ -254,6 +283,22 @@ saved.
254283
Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make
255284
sure to await [`method: BrowserContext.close`] for videos to be saved.
256285

286+
## python-context-option-recordvideo-dir
287+
* langs: python
288+
- `record_video_dir` <[path]>
289+
290+
Path to the directory to put videos into.
291+
292+
## python-context-option-recordvideo-size
293+
* langs: python
294+
- `record_video_size` <[Object]>
295+
If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of each page will be
296+
scaled down if necessary to fit the specified size.
297+
- `width` <[int]> Video frame width.
298+
- `height` <[int]> Video frame height.
299+
300+
Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport`.
301+
257302
## context-option-proxy
258303
- `proxy` <[Object]>
259304
- `server` <[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example
@@ -335,6 +380,8 @@ Optional.
335380
- %%-context-option-ignorehttpserrors-%%
336381
- %%-context-option-bypasscsp-%%
337382
- %%-context-option-viewport-%%
383+
- %%-python-context-option-viewport-%%
384+
- %%-python-context-option-no-viewport-%%
338385
- %%-context-option-useragent-%%
339386
- %%-context-option-devicescalefactor-%%
340387
- %%-context-option-ismobile-%%
@@ -352,4 +399,8 @@ Optional.
352399
- %%-context-option-videospath-%%
353400
- %%-context-option-videosize-%%
354401
- %%-context-option-recordhar-%%
402+
- %%-python-context-option-recordhar-path-%%
403+
- %%-python-context-option-recordhar-omit-content-%%
355404
- %%-context-option-recordvideo-%%
405+
- %%-python-context-option-recordvideo-dir-%%
406+
- %%-python-context-option-recordvideo-size-%%

0 commit comments

Comments
 (0)