From ed9fc205b0620ae83973711a7b781f67a4179412 Mon Sep 17 00:00:00 2001 From: Pavel Date: Thu, 12 Nov 2020 16:59:38 -0800 Subject: [PATCH] chore: roll Playwright to 1.6 --- build_package.py | 4 ++-- buildbots/test-sync-generation.sh | 5 ++-- playwright/async_api.py | 39 ++++++++++++++++++++----------- playwright/browser.py | 8 +++++++ playwright/browser_type.py | 17 +++++++++++++- playwright/helper.py | 5 ++++ playwright/page.py | 7 ++++++ playwright/sync_api.py | 39 ++++++++++++++++++++----------- scripts/expected_api_mismatch.txt | 3 ++- scripts/generate_api.py | 2 +- 10 files changed, 96 insertions(+), 33 deletions(-) diff --git a/build_package.py b/build_package.py index b00e2c0bb..1203d606f 100644 --- a/build_package.py +++ b/build_package.py @@ -22,8 +22,8 @@ from playwright.path_utils import get_file_dirname -driver_version_64 = "0.160.0-next.1604373941495" -driver_version_32 = "0.160.0-next.1604373978475" +driver_version_64 = "0.160.0-next.1605227932803" +driver_version_32 = "0.160.0-next.1605227936643" def driver_version(platform: str) -> str: diff --git a/buildbots/test-sync-generation.sh b/buildbots/test-sync-generation.sh index 012217ecc..565d14b9c 100644 --- a/buildbots/test-sync-generation.sh +++ b/buildbots/test-sync-generation.sh @@ -5,14 +5,15 @@ function assert_script { oldfile="playwright/$2" echo "Testing $newfile against $oldfile" - python $1 > $newfile + if ! python $1 > $newfile; then + exit 1 + fi pre-commit run --files $newfile cmp $oldfile $newfile exit_code=$? rm $newfile - return $exit_code } assert_script "scripts/generate_sync_api.py" "sync_api.py" diff --git a/playwright/async_api.py b/playwright/async_api.py index d979af12c..5360ddd73 100644 --- a/playwright/async_api.py +++ b/playwright/async_api.py @@ -50,6 +50,7 @@ PdfMargins, ProxyServer, RecordHarOptions, + RecordVideoOptions, RequestFailure, ResourceTiming, SelectOption, @@ -5839,6 +5840,7 @@ async def newContext( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> "BrowserContext": """Browser.newContext @@ -5882,11 +5884,13 @@ async def newContext( proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] Network proxy settings to use with this context. Note that browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'per-context' } })`. videosPath : Optional[str] - Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. + **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. videoSize : Optional[{"width": int, "height": int}] - 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. + **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. 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. recordHar : Optional[{"omitContent": Optional[bool], "path": str}] - Enables HAR recording for all pages into `har.path` file. If not specified, the HAR is not recorded. Make sure to await `browserContext.close` for the HAR to be saved. + Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await `browserContext.close` for the HAR to be saved. + recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}] + Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. Returns ------- @@ -5916,6 +5920,7 @@ async def newContext( videosPath=videosPath, videoSize=videoSize, recordHar=recordHar, + recordVideo=recordVideo, ) ) @@ -5943,6 +5948,7 @@ async def newPage( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> "Page": """Browser.newPage @@ -5987,11 +5993,13 @@ async def newPage( proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] Network proxy settings to use with this context. Note that browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'per-context' } })`. videosPath : Optional[str] - Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `page.close` for videos to be saved. + **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `page.close` for videos to be saved. videoSize : Optional[{"width": int, "height": int}] - 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. + **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. 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. recordHar : Optional[{"omitContent": Optional[bool], "path": str}] - Enables HAR recording for all pages into `har.path` file. If not specified, the HAR is not recorded. Make sure to await `page.close` for the HAR to be saved. + Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await `page.close` for the HAR to be saved. + recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}] + Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `page.close` for videos to be saved. Returns ------- @@ -6021,6 +6029,7 @@ async def newPage( videosPath=videosPath, videoSize=videoSize, recordHar=recordHar, + recordVideo=recordVideo, ) ) @@ -6118,7 +6127,7 @@ async def launch( proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] Network proxy settings. downloadsPath : Union[str, pathlib.Path, NoneType] - If specified, accepted downloads are downloaded into this folder. Otherwise, temporary folder is created and is deleted when browser is closed. + If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed. slowMo : Optional[int] Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. chromiumSandbox : Optional[bool] @@ -6167,7 +6176,7 @@ async def launchPersistentContext( proxy: ProxyServer = None, downloadsPath: typing.Union[str, pathlib.Path] = None, slowMo: int = None, - viewport: IntSize = None, + viewport: typing.Union[IntSize, Literal[0]] = None, ignoreHTTPSErrors: bool = None, javaScriptEnabled: bool = None, bypassCSP: bool = None, @@ -6188,6 +6197,7 @@ async def launchPersistentContext( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> "BrowserContext": """BrowserType.launchPersistentContext @@ -6220,10 +6230,10 @@ async def launchPersistentContext( proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] Network proxy settings. downloadsPath : Union[str, pathlib.Path, NoneType] - If specified, accepted downloads are downloaded into this folder. Otherwise, temporary folder is created and is deleted when browser is closed. + If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed. slowMo : Optional[int] Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0. - viewport : Optional[{"width": int, "height": int}] + viewport : Union[{"width": int, "height": int}, '0', NoneType] Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport. ignoreHTTPSErrors : Optional[bool] Whether to ignore HTTPS errors during navigation. Defaults to `false`. @@ -6259,11 +6269,13 @@ async def launchPersistentContext( chromiumSandbox : Optional[bool] Enable Chromium sandboxing. Defaults to `true`. videosPath : Optional[str] - Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. + **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. videoSize : Optional[{"width": int, "height": int}] - 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. + **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. 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. recordHar : Optional[{"omitContent": Optional[bool], "path": str}] - Enables HAR recording for all the pages into `har.path` file. If not specified, HAR is not recorded. Make sure to await `page.close` for HAR to be saved. + Enables HAR recording for all the pages into `recordHar.path` file. If not specified, HAR is not recorded. Make sure to await `page.close` for HAR to be saved. + recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}] + Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. Returns ------- @@ -6307,6 +6319,7 @@ async def launchPersistentContext( videosPath=videosPath, videoSize=videoSize, recordHar=recordHar, + recordVideo=recordVideo, ) ) diff --git a/playwright/browser.py b/playwright/browser.py index b1ba22714..a0e07bb4a 100644 --- a/playwright/browser.py +++ b/playwright/browser.py @@ -25,6 +25,7 @@ IntSize, ProxyServer, RecordHarOptions, + RecordVideoOptions, is_safe_close_error, locals_to_params, ) @@ -93,6 +94,7 @@ async def newContext( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> BrowserContext: params = locals_to_params(locals()) # Python is strict in which variables gets passed to methods. We get this @@ -104,6 +106,11 @@ async def newContext( params["noDefaultViewport"] = True if extraHTTPHeaders: params["extraHTTPHeaders"] = serialize_headers(extraHTTPHeaders) + if not recordVideo and videosPath: + params["recordVideo"] = {"dir": videosPath} + if videoSize: + params["recordVideo"]["size"] = videoSize + channel = await self._channel.send("newContext", params) context = from_channel(channel) self._contexts.append(context) @@ -135,6 +142,7 @@ async def newPage( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> Page: params = locals_to_params(locals()) # Python is strict in which variables gets passed to methods. We get this diff --git a/playwright/browser_type.py b/playwright/browser_type.py index 1ddc9d8b4..8898ada91 100644 --- a/playwright/browser_type.py +++ b/playwright/browser_type.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys from pathlib import Path from typing import Dict, List, Union @@ -26,11 +27,17 @@ IntSize, ProxyServer, RecordHarOptions, + RecordVideoOptions, locals_to_params, not_installed_error, ) from playwright.network import serialize_headers +if sys.version_info >= (3, 8): # pragma: no cover + from typing import Literal +else: # pragma: no cover + from typing_extensions import Literal + class BrowserType(ChannelOwner): def __init__( @@ -89,7 +96,7 @@ async def launchPersistentContext( proxy: ProxyServer = None, downloadsPath: Union[str, Path] = None, slowMo: int = None, - viewport: IntSize = None, + viewport: Union[IntSize, Literal[0]] = None, ignoreHTTPSErrors: bool = None, javaScriptEnabled: bool = None, bypassCSP: bool = None, @@ -110,11 +117,19 @@ async def launchPersistentContext( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> BrowserContext: userDataDir = str(Path(userDataDir)) params = locals_to_params(locals()) + if viewport == 0: + del params["viewport"] + params["noDefaultViewport"] = True if extraHTTPHeaders: params["extraHTTPHeaders"] = serialize_headers(extraHTTPHeaders) + if not recordVideo and videosPath: + params["recordVideo"] = {"dir": videosPath} + if videoSize: + params["recordVideo"]["size"] = videoSize normalize_launch_params(params) try: context = from_channel( diff --git a/playwright/helper.py b/playwright/helper.py index a8d54ca4f..3faf76c1d 100644 --- a/playwright/helper.py +++ b/playwright/helper.py @@ -190,6 +190,11 @@ class RecordHarOptions(TypedDict): path: str +class RecordVideoOptions(TypedDict): + dir: str + size: Optional[Viewport] + + DeviceDescriptor = TypedDict( "DeviceDescriptor", { diff --git a/playwright/page.py b/playwright/page.py index 3ceb1c0da..0abb88e01 100644 --- a/playwright/page.py +++ b/playwright/page.py @@ -294,6 +294,10 @@ def _add_event_handler(self, event: str, k: Any, v: Any) -> None: self._channel.send_no_reply( "setFileChooserInterceptedNoReply", {"intercepted": True} ) + if event == Page.Events.WebSocket and len(self.listeners(event)) == 0: + self._channel.send_no_reply( + "setWebSocketFramesReportingEnabledNoReply", {"enabled": True} + ) super()._add_event_handler(event, k, v) def remove_listener(self, event: str, f: Any) -> None: @@ -302,6 +306,9 @@ def remove_listener(self, event: str, f: Any) -> None: self._channel.send_no_reply( "setFileChooserInterceptedNoReply", {"intercepted": False} ) + # Note: we do not stop reporting web socket frames, since + # user might not listen to 'websocket' anymore, but still have + # a functioning WebSocket object. @property def context(self) -> "BrowserContext": diff --git a/playwright/sync_api.py b/playwright/sync_api.py index fccc20fae..85204247d 100644 --- a/playwright/sync_api.py +++ b/playwright/sync_api.py @@ -49,6 +49,7 @@ PdfMargins, ProxyServer, RecordHarOptions, + RecordVideoOptions, RequestFailure, ResourceTiming, SelectOption, @@ -6075,6 +6076,7 @@ def newContext( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> "BrowserContext": """Browser.newContext @@ -6118,11 +6120,13 @@ def newContext( proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] Network proxy settings to use with this context. Note that browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'per-context' } })`. videosPath : Optional[str] - Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. + **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. videoSize : Optional[{"width": int, "height": int}] - 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. + **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. 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. recordHar : Optional[{"omitContent": Optional[bool], "path": str}] - Enables HAR recording for all pages into `har.path` file. If not specified, the HAR is not recorded. Make sure to await `browserContext.close` for the HAR to be saved. + Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await `browserContext.close` for the HAR to be saved. + recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}] + Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. Returns ------- @@ -6153,6 +6157,7 @@ def newContext( videosPath=videosPath, videoSize=videoSize, recordHar=recordHar, + recordVideo=recordVideo, ) ) ) @@ -6181,6 +6186,7 @@ def newPage( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> "Page": """Browser.newPage @@ -6225,11 +6231,13 @@ def newPage( proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] Network proxy settings to use with this context. Note that browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'per-context' } })`. videosPath : Optional[str] - Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `page.close` for videos to be saved. + **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `page.close` for videos to be saved. videoSize : Optional[{"width": int, "height": int}] - 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. + **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. 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. recordHar : Optional[{"omitContent": Optional[bool], "path": str}] - Enables HAR recording for all pages into `har.path` file. If not specified, the HAR is not recorded. Make sure to await `page.close` for the HAR to be saved. + Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await `page.close` for the HAR to be saved. + recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}] + Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `page.close` for videos to be saved. Returns ------- @@ -6260,6 +6268,7 @@ def newPage( videosPath=videosPath, videoSize=videoSize, recordHar=recordHar, + recordVideo=recordVideo, ) ) ) @@ -6358,7 +6367,7 @@ def launch( proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] Network proxy settings. downloadsPath : Union[str, pathlib.Path, NoneType] - If specified, accepted downloads are downloaded into this folder. Otherwise, temporary folder is created and is deleted when browser is closed. + If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed. slowMo : Optional[int] Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. chromiumSandbox : Optional[bool] @@ -6409,7 +6418,7 @@ def launchPersistentContext( proxy: ProxyServer = None, downloadsPath: typing.Union[str, pathlib.Path] = None, slowMo: int = None, - viewport: IntSize = None, + viewport: typing.Union[IntSize, Literal[0]] = None, ignoreHTTPSErrors: bool = None, javaScriptEnabled: bool = None, bypassCSP: bool = None, @@ -6430,6 +6439,7 @@ def launchPersistentContext( videosPath: str = None, videoSize: IntSize = None, recordHar: RecordHarOptions = None, + recordVideo: RecordVideoOptions = None, ) -> "BrowserContext": """BrowserType.launchPersistentContext @@ -6462,10 +6472,10 @@ def launchPersistentContext( proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] Network proxy settings. downloadsPath : Union[str, pathlib.Path, NoneType] - If specified, accepted downloads are downloaded into this folder. Otherwise, temporary folder is created and is deleted when browser is closed. + If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed. slowMo : Optional[int] Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0. - viewport : Optional[{"width": int, "height": int}] + viewport : Union[{"width": int, "height": int}, '0', NoneType] Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport. ignoreHTTPSErrors : Optional[bool] Whether to ignore HTTPS errors during navigation. Defaults to `false`. @@ -6501,11 +6511,13 @@ def launchPersistentContext( chromiumSandbox : Optional[bool] Enable Chromium sandboxing. Defaults to `true`. videosPath : Optional[str] - Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. + **NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to `videosPath` directory. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. videoSize : Optional[{"width": int, "height": int}] - 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. + **NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. 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. recordHar : Optional[{"omitContent": Optional[bool], "path": str}] - Enables HAR recording for all the pages into `har.path` file. If not specified, HAR is not recorded. Make sure to await `page.close` for HAR to be saved. + Enables HAR recording for all the pages into `recordHar.path` file. If not specified, HAR is not recorded. Make sure to await `page.close` for HAR to be saved. + recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}] + Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await `browserContext.close` for videos to be saved. Returns ------- @@ -6550,6 +6562,7 @@ def launchPersistentContext( videosPath=videosPath, videoSize=videoSize, recordHar=recordHar, + recordVideo=recordVideo, ) ) ) diff --git a/scripts/expected_api_mismatch.txt b/scripts/expected_api_mismatch.txt index 42ac17c9d..ec9b20ef9 100644 --- a/scripts/expected_api_mismatch.txt +++ b/scripts/expected_api_mismatch.txt @@ -36,7 +36,7 @@ Parameter type mismatch in BrowserContext.setGeolocation(geolocation=): document Parameter type mismatch in BrowserContext.waitForEvent(return=): documented as Dict, code has Any Parameter type mismatch in Browser.newContext(viewport=): documented as Optional[Dict], code has Union[{"width": int, "height": int}, '0', NoneType] Parameter type mismatch in Browser.newPage(viewport=): documented as Optional[Dict], code has Union[{"width": int, "height": int}, '0', NoneType] -Parameter type mismatch in BrowserType.launchPersistentContext(viewport=): documented as Optional[Dict], code has Optional[{"width": int, "height": int}] +Parameter type mismatch in BrowserType.launchPersistentContext(viewport=): documented as Optional[Dict], code has Union[{"width": int, "height": int}, '0', NoneType] Parameter type mismatch in ElementHandle.boundingBox(return=): documented as Optional[Dict], code has Optional[{"x": float, "y": float, "width": float, "height": float}] Parameter type mismatch in Page.viewportSize(return=): documented as Optional[Dict], code has Optional[{"width": int, "height": int}] Parameter type mismatch in Page.waitForEvent(return=): documented as Dict, code has Any @@ -113,6 +113,7 @@ Parameter not implemented: Browser.newPage(logger=) # Deprecated Parameter not implemented: Page.addInitScript(arg=) Parameter not implemented: BrowserContext.addInitScript(arg=) +Method not implemented: BrowserType.connect # OptionsOr Parameter not implemented: Page.waitForEvent(optionsOrPredicate=) diff --git a/scripts/generate_api.py b/scripts/generate_api.py index 71d2a8a17..7d7e4fe13 100644 --- a/scripts/generate_api.py +++ b/scripts/generate_api.py @@ -163,7 +163,7 @@ def return_value(value: Any) -> List[str]: from playwright.element_handle import ElementHandle as ElementHandleImpl from playwright.file_chooser import FileChooser as FileChooserImpl from playwright.frame import Frame as FrameImpl -from playwright.helper import ConsoleMessageLocation, Credentials, MousePosition, Error, FilePayload, SelectOption, RequestFailure, Viewport, DeviceDescriptor, IntSize, FloatRect, Geolocation, ProxyServer, PdfMargins, ResourceTiming, RecordHarOptions +from playwright.helper import ConsoleMessageLocation, Credentials, MousePosition, Error, FilePayload, SelectOption, RequestFailure, Viewport, DeviceDescriptor, IntSize, FloatRect, Geolocation, ProxyServer, PdfMargins, ResourceTiming, RecordHarOptions, RecordVideoOptions from playwright.input import Keyboard as KeyboardImpl, Mouse as MouseImpl, Touchscreen as TouchscreenImpl from playwright.js_handle import JSHandle as JSHandleImpl from playwright.network import Request as RequestImpl, Response as ResponseImpl, Route as RouteImpl, WebSocket as WebSocketImpl