Skip to content

Commit fc0e796

Browse files
authored
feat(roll): improved parameter validation, rolling 1.5 apis (#229)
1 parent b700b4a commit fc0e796

File tree

8 files changed

+148
-34
lines changed

8 files changed

+148
-34
lines changed

playwright/async_api.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,7 @@ async def dblclick(
22952295
button: Literal["left", "middle", "right"] = None,
22962296
timeout: int = None,
22972297
force: bool = None,
2298+
noWaitAfter: bool = None,
22982299
) -> NoneType:
22992300
"""Frame.dblclick
23002301
@@ -2326,6 +2327,8 @@ async def dblclick(
23262327
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) or page.setDefaultTimeout(timeout) methods.
23272328
force : Optional[bool]
23282329
Whether to bypass the actionability checks. Defaults to `false`.
2330+
noWaitAfter : Optional[bool]
2331+
Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
23292332
"""
23302333
return mapping.from_maybe_impl(
23312334
await self._impl_obj.dblclick(
@@ -2336,6 +2339,7 @@ async def dblclick(
23362339
button=button,
23372340
timeout=timeout,
23382341
force=force,
2342+
noWaitAfter=noWaitAfter,
23392343
)
23402344
)
23412345

@@ -4314,6 +4318,7 @@ async def dblclick(
43144318
button: Literal["left", "middle", "right"] = None,
43154319
timeout: int = None,
43164320
force: bool = None,
4321+
noWaitAfter: bool = None,
43174322
) -> NoneType:
43184323
"""Page.dblclick
43194324
@@ -4347,6 +4352,8 @@ async def dblclick(
43474352
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) or page.setDefaultTimeout(timeout) methods.
43484353
force : Optional[bool]
43494354
Whether to bypass the actionability checks. Defaults to `false`.
4355+
noWaitAfter : Optional[bool]
4356+
Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
43504357
"""
43514358
return mapping.from_maybe_impl(
43524359
await self._impl_obj.dblclick(
@@ -4357,6 +4364,7 @@ async def dblclick(
43574364
button=button,
43584365
timeout=timeout,
43594366
force=force,
4367+
noWaitAfter=noWaitAfter,
43604368
)
43614369
)
43624370

@@ -5576,6 +5584,8 @@ async def newContext(
55765584
colorScheme: Literal["dark", "light", "no-preference"] = None,
55775585
acceptDownloads: bool = None,
55785586
defaultBrowserType: str = None,
5587+
videosPath: str = None,
5588+
videoSize: IntSize = None,
55795589
) -> "BrowserContext":
55805590
"""Browser.newContext
55815591
@@ -5616,6 +5626,10 @@ async def newContext(
56165626
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See page.emulateMedia(options) for more details. Defaults to '`light`'.
56175627
acceptDownloads : Optional[bool]
56185628
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
5629+
videosPath : Optional[str]
5630+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5631+
videoSize : Optional[{"width": int, "height": int}]
5632+
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
56195633
56205634
Returns
56215635
-------
@@ -5641,6 +5655,8 @@ async def newContext(
56415655
colorScheme=colorScheme,
56425656
acceptDownloads=acceptDownloads,
56435657
defaultBrowserType=defaultBrowserType,
5658+
videosPath=videosPath,
5659+
videoSize=videoSize,
56445660
)
56455661
)
56465662

@@ -5664,6 +5680,8 @@ async def newPage(
56645680
colorScheme: Literal["dark", "light", "no-preference"] = None,
56655681
acceptDownloads: bool = None,
56665682
defaultBrowserType: str = None,
5683+
videosPath: str = None,
5684+
videoSize: IntSize = None,
56675685
) -> "Page":
56685686
"""Browser.newPage
56695687
@@ -5705,6 +5723,10 @@ async def newPage(
57055723
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See page.emulateMedia(options) for more details. Defaults to '`light`'.
57065724
acceptDownloads : Optional[bool]
57075725
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
5726+
videosPath : Optional[str]
5727+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5728+
videoSize : Optional[{"width": int, "height": int}]
5729+
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
57085730
57095731
Returns
57105732
-------
@@ -5730,6 +5752,8 @@ async def newPage(
57305752
colorScheme=colorScheme,
57315753
acceptDownloads=acceptDownloads,
57325754
defaultBrowserType=defaultBrowserType,
5755+
videosPath=videosPath,
5756+
videoSize=videoSize,
57335757
)
57345758
)
57355759

@@ -5789,6 +5813,9 @@ async def launch(
57895813
downloadsPath: typing.Union[str, pathlib.Path] = None,
57905814
slowMo: int = None,
57915815
chromiumSandbox: bool = None,
5816+
firefoxUserPrefs: typing.Union[
5817+
typing.Dict[str, typing.Union[str, int, bool]]
5818+
] = None,
57925819
) -> "Browser":
57935820
"""BrowserType.launch
57945821
@@ -5829,6 +5856,8 @@ async def launch(
58295856
Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
58305857
chromiumSandbox : Optional[bool]
58315858
Enable Chromium sandboxing. Defaults to `false`.
5859+
firefoxUserPrefs : Optional[Dict[str, Union[str, int, bool]]]
5860+
Firefox user preferences. Learn more about the Firefox user preferences at `about:config`.
58325861
58335862
Returns
58345863
-------
@@ -5851,6 +5880,7 @@ async def launch(
58515880
downloadsPath=downloadsPath,
58525881
slowMo=slowMo,
58535882
chromiumSandbox=chromiumSandbox,
5883+
firefoxUserPrefs=mapping.to_impl(firefoxUserPrefs),
58545884
)
58555885
)
58565886

@@ -5888,6 +5918,8 @@ async def launchPersistentContext(
58885918
colorScheme: Literal["dark", "light", "no-preference"] = None,
58895919
acceptDownloads: bool = None,
58905920
chromiumSandbox: bool = None,
5921+
videosPath: str = None,
5922+
videoSize: IntSize = None,
58915923
) -> "BrowserContext":
58925924
"""BrowserType.launchPersistentContext
58935925
@@ -5958,6 +5990,10 @@ async def launchPersistentContext(
59585990
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
59595991
chromiumSandbox : Optional[bool]
59605992
Enable Chromium sandboxing. Defaults to `true`.
5993+
videosPath : Optional[str]
5994+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5995+
videoSize : Optional[{"width": int, "height": int}]
5996+
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
59615997
59625998
Returns
59635999
-------
@@ -5998,6 +6034,8 @@ async def launchPersistentContext(
59986034
colorScheme=colorScheme,
59996035
acceptDownloads=acceptDownloads,
60006036
chromiumSandbox=chromiumSandbox,
6037+
videosPath=videosPath,
6038+
videoSize=videoSize,
60016039
)
60026040
)
60036041

playwright/browser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ async def newContext(
8686
colorScheme: ColorScheme = None,
8787
acceptDownloads: bool = None,
8888
defaultBrowserType: str = None,
89+
videosPath: str = None,
90+
videoSize: IntSize = None,
8991
) -> BrowserContext:
9092
params = locals_to_params(locals())
9193
# Python is strict in which variables gets passed to methods. We get this
@@ -123,6 +125,8 @@ async def newPage(
123125
colorScheme: ColorScheme = None,
124126
acceptDownloads: bool = None,
125127
defaultBrowserType: str = None,
128+
videosPath: str = None,
129+
videoSize: IntSize = None,
126130
) -> Page:
127131
params = locals_to_params(locals())
128132
# Python is strict in which variables gets passed to methods. We get this

playwright/browser_type.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ async def launch(
6161
downloadsPath: Union[str, Path] = None,
6262
slowMo: int = None,
6363
chromiumSandbox: bool = None,
64+
firefoxUserPrefs: Dict[str, Union[str, int, bool]] = None,
6465
) -> Browser:
6566
params = locals_to_params(locals())
6667
normalize_launch_params(params)
@@ -105,6 +106,8 @@ async def launchPersistentContext(
105106
colorScheme: ColorScheme = None,
106107
acceptDownloads: bool = None,
107108
chromiumSandbox: bool = None,
109+
videosPath: str = None,
110+
videoSize: IntSize = None,
108111
) -> BrowserContext:
109112
userDataDir = str(Path(userDataDir))
110113
params = locals_to_params(locals())

playwright/frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ async def dblclick(
372372
button: MouseButton = None,
373373
timeout: int = None,
374374
force: bool = None,
375+
noWaitAfter: bool = None,
375376
) -> None:
376377
await self._channel.send("dblclick", locals_to_params(locals()))
377378

playwright/page.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ async def dblclick(
615615
button: MouseButton = None,
616616
timeout: int = None,
617617
force: bool = None,
618+
noWaitAfter: bool = None,
618619
) -> None:
619620
return await self._main_frame.dblclick(**locals_to_params(locals()))
620621

playwright/sync_api.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,6 +2377,7 @@ def dblclick(
23772377
button: Literal["left", "middle", "right"] = None,
23782378
timeout: int = None,
23792379
force: bool = None,
2380+
noWaitAfter: bool = None,
23802381
) -> NoneType:
23812382
"""Frame.dblclick
23822383
@@ -2408,6 +2409,8 @@ def dblclick(
24082409
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) or page.setDefaultTimeout(timeout) methods.
24092410
force : Optional[bool]
24102411
Whether to bypass the actionability checks. Defaults to `false`.
2412+
noWaitAfter : Optional[bool]
2413+
Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
24112414
"""
24122415
return mapping.from_maybe_impl(
24132416
self._sync(
@@ -2419,6 +2422,7 @@ def dblclick(
24192422
button=button,
24202423
timeout=timeout,
24212424
force=force,
2425+
noWaitAfter=noWaitAfter,
24222426
)
24232427
)
24242428
)
@@ -4488,6 +4492,7 @@ def dblclick(
44884492
button: Literal["left", "middle", "right"] = None,
44894493
timeout: int = None,
44904494
force: bool = None,
4495+
noWaitAfter: bool = None,
44914496
) -> NoneType:
44924497
"""Page.dblclick
44934498
@@ -4521,6 +4526,8 @@ def dblclick(
45214526
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) or page.setDefaultTimeout(timeout) methods.
45224527
force : Optional[bool]
45234528
Whether to bypass the actionability checks. Defaults to `false`.
4529+
noWaitAfter : Optional[bool]
4530+
Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
45244531
"""
45254532
return mapping.from_maybe_impl(
45264533
self._sync(
@@ -4532,6 +4539,7 @@ def dblclick(
45324539
button=button,
45334540
timeout=timeout,
45344541
force=force,
4542+
noWaitAfter=noWaitAfter,
45354543
)
45364544
)
45374545
)
@@ -5806,6 +5814,8 @@ def newContext(
58065814
colorScheme: Literal["dark", "light", "no-preference"] = None,
58075815
acceptDownloads: bool = None,
58085816
defaultBrowserType: str = None,
5817+
videosPath: str = None,
5818+
videoSize: IntSize = None,
58095819
) -> "BrowserContext":
58105820
"""Browser.newContext
58115821
@@ -5846,6 +5856,10 @@ def newContext(
58465856
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See page.emulateMedia(options) for more details. Defaults to '`light`'.
58475857
acceptDownloads : Optional[bool]
58485858
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
5859+
videosPath : Optional[str]
5860+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5861+
videoSize : Optional[{"width": int, "height": int}]
5862+
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
58495863
58505864
Returns
58515865
-------
@@ -5872,6 +5886,8 @@ def newContext(
58725886
colorScheme=colorScheme,
58735887
acceptDownloads=acceptDownloads,
58745888
defaultBrowserType=defaultBrowserType,
5889+
videosPath=videosPath,
5890+
videoSize=videoSize,
58755891
)
58765892
)
58775893
)
@@ -5896,6 +5912,8 @@ def newPage(
58965912
colorScheme: Literal["dark", "light", "no-preference"] = None,
58975913
acceptDownloads: bool = None,
58985914
defaultBrowserType: str = None,
5915+
videosPath: str = None,
5916+
videoSize: IntSize = None,
58995917
) -> "Page":
59005918
"""Browser.newPage
59015919
@@ -5937,6 +5955,10 @@ def newPage(
59375955
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See page.emulateMedia(options) for more details. Defaults to '`light`'.
59385956
acceptDownloads : Optional[bool]
59395957
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
5958+
videosPath : Optional[str]
5959+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5960+
videoSize : Optional[{"width": int, "height": int}]
5961+
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
59405962
59415963
Returns
59425964
-------
@@ -5963,6 +5985,8 @@ def newPage(
59635985
colorScheme=colorScheme,
59645986
acceptDownloads=acceptDownloads,
59655987
defaultBrowserType=defaultBrowserType,
5988+
videosPath=videosPath,
5989+
videoSize=videoSize,
59665990
)
59675991
)
59685992
)
@@ -6023,6 +6047,9 @@ def launch(
60236047
downloadsPath: typing.Union[str, pathlib.Path] = None,
60246048
slowMo: int = None,
60256049
chromiumSandbox: bool = None,
6050+
firefoxUserPrefs: typing.Union[
6051+
typing.Dict[str, typing.Union[str, int, bool]]
6052+
] = None,
60266053
) -> "Browser":
60276054
"""BrowserType.launch
60286055
@@ -6063,6 +6090,8 @@ def launch(
60636090
Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
60646091
chromiumSandbox : Optional[bool]
60656092
Enable Chromium sandboxing. Defaults to `false`.
6093+
firefoxUserPrefs : Optional[Dict[str, Union[str, int, bool]]]
6094+
Firefox user preferences. Learn more about the Firefox user preferences at `about:config`.
60666095
60676096
Returns
60686097
-------
@@ -6086,6 +6115,7 @@ def launch(
60866115
downloadsPath=downloadsPath,
60876116
slowMo=slowMo,
60886117
chromiumSandbox=chromiumSandbox,
6118+
firefoxUserPrefs=mapping.to_impl(firefoxUserPrefs),
60896119
)
60906120
)
60916121
)
@@ -6124,6 +6154,8 @@ def launchPersistentContext(
61246154
colorScheme: Literal["dark", "light", "no-preference"] = None,
61256155
acceptDownloads: bool = None,
61266156
chromiumSandbox: bool = None,
6157+
videosPath: str = None,
6158+
videoSize: IntSize = None,
61276159
) -> "BrowserContext":
61286160
"""BrowserType.launchPersistentContext
61296161
@@ -6194,6 +6226,10 @@ def launchPersistentContext(
61946226
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
61956227
chromiumSandbox : Optional[bool]
61966228
Enable Chromium sandboxing. Defaults to `true`.
6229+
videosPath : Optional[str]
6230+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
6231+
videoSize : Optional[{"width": int, "height": int}]
6232+
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
61976233
61986234
Returns
61996235
-------
@@ -6235,6 +6271,8 @@ def launchPersistentContext(
62356271
colorScheme=colorScheme,
62366272
acceptDownloads=acceptDownloads,
62376273
chromiumSandbox=chromiumSandbox,
6274+
videosPath=videosPath,
6275+
videoSize=videoSize,
62386276
)
62396277
)
62406278
)

0 commit comments

Comments
 (0)