From 1a4bdf70310980344c8c22650857e1944103629c Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Wed, 24 Mar 2021 10:47:51 +0530 Subject: [PATCH] chore: roll to Playwright v1.10.0 (#591) Co-authored-by: Andrey Lushnikov --- playwright/_impl/_browser_type.py | 5 ++- playwright/_impl/_helper.py | 11 +++++ playwright/async_api/_generated.py | 69 +++++++++++++++++------------- playwright/sync_api/_generated.py | 69 +++++++++++++++++------------- setup.py | 2 +- 5 files changed, 93 insertions(+), 63 deletions(-) diff --git a/playwright/_impl/_browser_type.py b/playwright/_impl/_browser_type.py index 358d43a07..69ec77df5 100644 --- a/playwright/_impl/_browser_type.py +++ b/playwright/_impl/_browser_type.py @@ -25,6 +25,7 @@ from playwright._impl._browser_context import BrowserContext from playwright._impl._connection import ChannelOwner, from_channel from playwright._impl._helper import ( + BrowserChannel, ColorScheme, Env, locals_to_params, @@ -52,7 +53,7 @@ def executable_path(self) -> str: async def launch( self, executablePath: Union[str, Path] = None, - channel: str = None, + channel: BrowserChannel = None, args: List[str] = None, ignoreDefaultArgs: Union[bool, List[str]] = None, handleSIGINT: bool = None, @@ -80,7 +81,7 @@ async def launch( async def launch_persistent_context( self, userDataDir: Union[str, Path], - channel: str = None, + channel: BrowserChannel = None, executablePath: Union[str, Path] = None, args: List[str] = None, ignoreDefaultArgs: Union[bool, List[str]] = None, diff --git a/playwright/_impl/_helper.py b/playwright/_impl/_helper.py index e68fb36de..7f961df19 100644 --- a/playwright/_impl/_helper.py +++ b/playwright/_impl/_helper.py @@ -52,6 +52,17 @@ KeyboardModifier = Literal["Alt", "Control", "Meta", "Shift"] MouseButton = Literal["left", "middle", "right"] +BrowserChannel = Literal[ + "chrome", + "chrome-beta", + "chrome-canary", + "chrome-dev", + "msedge", + "msedge-beta", + "msedge-canary", + "msedge-dev", +] + class ErrorPayload(TypedDict, total=False): message: str diff --git a/playwright/async_api/_generated.py b/playwright/async_api/_generated.py index 0c4ae2846..dbed04d65 100644 --- a/playwright/async_api/_generated.py +++ b/playwright/async_api/_generated.py @@ -92,8 +92,6 @@ def resource_type(self) -> str: following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`, `websocket`, `manifest`, `other`. - > NOTE: The resource types are available as constants in [ResourceTypes]. - Returns ------- str @@ -8641,11 +8639,14 @@ async def new_context( 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' } })`. record_har_path : Union[pathlib.Path, str, NoneType] - Path on the filesystem to write the HAR file to. + Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the + filesystem. If not specified, the HAR is not recorded. Make sure to call `browser_context.close()` for the HAR to + be saved. record_har_omit_content : Union[bool, NoneType] Optional setting to control whether to omit request content from the HAR. Defaults to `false`. record_video_dir : Union[pathlib.Path, str, NoneType] - Path to the directory to put videos into. + Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure + to call `browser_context.close()` for videos to be saved. record_video_size : Union[{width: int, height: int}, NoneType] Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will @@ -8778,11 +8779,14 @@ async def new_page( 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' } })`. record_har_path : Union[pathlib.Path, str, NoneType] - Path on the filesystem to write the HAR file to. + Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the + filesystem. If not specified, the HAR is not recorded. Make sure to call `browser_context.close()` for the HAR to + be saved. record_har_omit_content : Union[bool, NoneType] Optional setting to control whether to omit request content from the HAR. Defaults to `false`. record_video_dir : Union[pathlib.Path, str, NoneType] - Path to the directory to put videos into. + Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure + to call `browser_context.close()` for videos to be saved. record_video_size : Union[{width: int, height: int}, NoneType] Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will @@ -8882,7 +8886,16 @@ async def launch( self, *, executable_path: typing.Union[str, pathlib.Path] = None, - channel: str = None, + channel: Literal[ + "chrome", + "chrome-beta", + "chrome-canary", + "chrome-dev", + "msedge", + "msedge-beta", + "msedge-canary", + "msedge-dev", + ] = None, args: typing.List[str] = None, ignore_default_args: typing.Union[bool, typing.List[str]] = None, handle_sigint: bool = None, @@ -8933,16 +8946,8 @@ async def launch( Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk. - channel : Union[str, NoneType] - Chromium distribution channel, one of - - chrome - - chrome-beta - - chrome-dev - - chrome-canary - - msedge - - msedge-beta - - msedge-dev - - msedge-canary + channel : Union["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] + Browser distribution channel. args : Union[List[str], NoneType] 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/). @@ -9014,7 +9019,16 @@ async def launch_persistent_context( self, user_data_dir: typing.Union[str, pathlib.Path], *, - channel: str = None, + channel: Literal[ + "chrome", + "chrome-beta", + "chrome-canary", + "chrome-dev", + "msedge", + "msedge-beta", + "msedge-canary", + "msedge-dev", + ] = None, executable_path: typing.Union[str, pathlib.Path] = None, args: typing.List[str] = None, ignore_default_args: typing.Union[bool, typing.List[str]] = None, @@ -9066,16 +9080,8 @@ async def launch_persistent_context( [Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#introduction) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile). Note that Chromium's user data directory is the **parent** directory of the "Profile Path" seen at `chrome://version`. - channel : Union[str, NoneType] - Chromium distribution channel, one of - - chrome - - chrome-beta - - chrome-dev - - chrome-canary - - msedge - - msedge-beta - - msedge-dev - - msedge-canary + channel : Union["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] + Browser distribution channel. executable_path : Union[pathlib.Path, str, NoneType] Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled @@ -9157,11 +9163,14 @@ async def launch_persistent_context( chromium_sandbox : Union[bool, NoneType] Enable Chromium sandboxing. Defaults to `true`. record_har_path : Union[pathlib.Path, str, NoneType] - Path on the filesystem to write the HAR file to. + Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the + filesystem. If not specified, the HAR is not recorded. Make sure to call `browser_context.close()` for the HAR to + be saved. record_har_omit_content : Union[bool, NoneType] Optional setting to control whether to omit request content from the HAR. Defaults to `false`. record_video_dir : Union[pathlib.Path, str, NoneType] - Path to the directory to put videos into. + Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure + to call `browser_context.close()` for videos to be saved. record_video_size : Union[{width: int, height: int}, NoneType] Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will diff --git a/playwright/sync_api/_generated.py b/playwright/sync_api/_generated.py index a6521137a..da05b60c5 100644 --- a/playwright/sync_api/_generated.py +++ b/playwright/sync_api/_generated.py @@ -92,8 +92,6 @@ def resource_type(self) -> str: following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`, `websocket`, `manifest`, `other`. - > NOTE: The resource types are available as constants in [ResourceTypes]. - Returns ------- str @@ -8587,11 +8585,14 @@ def new_context( 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' } })`. record_har_path : Union[pathlib.Path, str, NoneType] - Path on the filesystem to write the HAR file to. + Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the + filesystem. If not specified, the HAR is not recorded. Make sure to call `browser_context.close()` for the HAR to + be saved. record_har_omit_content : Union[bool, NoneType] Optional setting to control whether to omit request content from the HAR. Defaults to `false`. record_video_dir : Union[pathlib.Path, str, NoneType] - Path to the directory to put videos into. + Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure + to call `browser_context.close()` for videos to be saved. record_video_size : Union[{width: int, height: int}, NoneType] Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will @@ -8724,11 +8725,14 @@ def new_page( 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' } })`. record_har_path : Union[pathlib.Path, str, NoneType] - Path on the filesystem to write the HAR file to. + Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the + filesystem. If not specified, the HAR is not recorded. Make sure to call `browser_context.close()` for the HAR to + be saved. record_har_omit_content : Union[bool, NoneType] Optional setting to control whether to omit request content from the HAR. Defaults to `false`. record_video_dir : Union[pathlib.Path, str, NoneType] - Path to the directory to put videos into. + Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure + to call `browser_context.close()` for videos to be saved. record_video_size : Union[{width: int, height: int}, NoneType] Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will @@ -8828,7 +8832,16 @@ def launch( self, *, executable_path: typing.Union[str, pathlib.Path] = None, - channel: str = None, + channel: Literal[ + "chrome", + "chrome-beta", + "chrome-canary", + "chrome-dev", + "msedge", + "msedge-beta", + "msedge-canary", + "msedge-dev", + ] = None, args: typing.List[str] = None, ignore_default_args: typing.Union[bool, typing.List[str]] = None, handle_sigint: bool = None, @@ -8879,16 +8892,8 @@ def launch( Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk. - channel : Union[str, NoneType] - Chromium distribution channel, one of - - chrome - - chrome-beta - - chrome-dev - - chrome-canary - - msedge - - msedge-beta - - msedge-dev - - msedge-canary + channel : Union["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] + Browser distribution channel. args : Union[List[str], NoneType] 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/). @@ -8960,7 +8965,16 @@ def launch_persistent_context( self, user_data_dir: typing.Union[str, pathlib.Path], *, - channel: str = None, + channel: Literal[ + "chrome", + "chrome-beta", + "chrome-canary", + "chrome-dev", + "msedge", + "msedge-beta", + "msedge-canary", + "msedge-dev", + ] = None, executable_path: typing.Union[str, pathlib.Path] = None, args: typing.List[str] = None, ignore_default_args: typing.Union[bool, typing.List[str]] = None, @@ -9012,16 +9026,8 @@ def launch_persistent_context( [Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#introduction) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile). Note that Chromium's user data directory is the **parent** directory of the "Profile Path" seen at `chrome://version`. - channel : Union[str, NoneType] - Chromium distribution channel, one of - - chrome - - chrome-beta - - chrome-dev - - chrome-canary - - msedge - - msedge-beta - - msedge-dev - - msedge-canary + channel : Union["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] + Browser distribution channel. executable_path : Union[pathlib.Path, str, NoneType] Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled @@ -9103,11 +9109,14 @@ def launch_persistent_context( chromium_sandbox : Union[bool, NoneType] Enable Chromium sandboxing. Defaults to `true`. record_har_path : Union[pathlib.Path, str, NoneType] - Path on the filesystem to write the HAR file to. + Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into the specified HAR file on the + filesystem. If not specified, the HAR is not recorded. Make sure to call `browser_context.close()` for the HAR to + be saved. record_har_omit_content : Union[bool, NoneType] Optional setting to control whether to omit request content from the HAR. Defaults to `false`. record_video_dir : Union[pathlib.Path, str, NoneType] - Path to the directory to put videos into. + Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure + to call `browser_context.close()` for videos to be saved. record_video_size : Union[{width: int, height: int}, NoneType] Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will diff --git a/setup.py b/setup.py index ac3464c6a..b644a46be 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ from auditwheel.wheeltools import InWheel from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand -driver_version = "1.10.0-next-1616094973000" +driver_version = "1.10.0-next-1616530863000" def extractall(zip: zipfile.ZipFile, path: str) -> None: