diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 63c5cae96..84a9b43f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,6 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer - exclude: ^playwright/drivers/browsers.json$ - id: check-yaml - id: check-toml - id: requirements-txt-fixer @@ -19,10 +18,10 @@ repos: hooks: - id: mypy - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 3.9.1 hooks: - id: flake8 - repo: https://github.com/pycqa/isort - rev: 5.7.0 + rev: 5.8.0 hooks: - id: isort diff --git a/README.md b/README.md index c4ae74724..36c5b362b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H | :--- | :---: | :---: | :---: | | Chromium 91.0.4469.0 | ✅ | ✅ | ✅ | | WebKit 14.2 | ✅ | ✅ | ✅ | -| Firefox 88.0b8 | ✅ | ✅ | ✅ | +| Firefox 89.0b2 | ✅ | ✅ | ✅ | Headless execution is supported for all browsers on all platforms. diff --git a/local-requirements.txt b/local-requirements.txt index 5fcaa62e9..f02c325d6 100644 --- a/local-requirements.txt +++ b/local-requirements.txt @@ -1,12 +1,12 @@ auditwheel==3.3.1 autobahn==21.3.1 black==20.8b1 -flake8==3.8.4 +flake8==3.9.1 flaky==3.7.0 mypy==0.812 objgraph==3.5.0 -pandas==1.2.3 -Pillow==8.1.1 +pandas==1.2.4 +Pillow==8.2.0 pixelmatch==0.2.3 pre-commit==2.10.1 pyOpenSSL==20.0.1 @@ -19,7 +19,7 @@ pytest-timeout==1.4.2 pytest-xdist==2.2.1 requests==2.25.1 service_identity==18.1.0 -setuptools==54.0.0 +setuptools==56.0.0 twine==3.3.0 twisted==21.2.0 wheel==0.36.2 diff --git a/playwright/_impl/_helper.py b/playwright/_impl/_helper.py index 8516fe0a3..8e6c01982 100644 --- a/playwright/_impl/_helper.py +++ b/playwright/_impl/_helper.py @@ -59,6 +59,7 @@ "chrome-beta", "chrome-canary", "chrome-dev", + "firefox-stable", "msedge", "msedge-beta", "msedge-canary", diff --git a/playwright/async_api/_generated.py b/playwright/async_api/_generated.py index 39b6f10c4..e6ee34ac4 100644 --- a/playwright/async_api/_generated.py +++ b/playwright/async_api/_generated.py @@ -784,6 +784,7 @@ async def type(self, text: str, *, delay: float = None) -> NoneType: ``` > NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case. + > NOTE: For characters that are not on a US keyboard, only an `input` event will be sent. Parameters ---------- @@ -6228,6 +6229,9 @@ async def emulate_media( ) -> NoneType: """Page.emulate_media + This method changes the `CSS media type` through the `media` argument, and/or the `'prefers-colors-scheme'` media + feature, using the `colorScheme` argument. + ```py await page.evaluate(\"matchMedia('screen').matches\") # → True @@ -8907,9 +8911,11 @@ async def new_context( accept_downloads : Union[bool, NoneType] Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled. proxy : Union[{server: str, bypass: Union[str, NoneType], username: Union[str, NoneType], password: Union[str, NoneType]}, NoneType] - 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' } })`. + Network proxy settings to use with this context. + + > NOTE: For Chromium on Windows the 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: 'http://per-context' } })`. record_har_path : Union[pathlib.Path, str, NoneType] 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 @@ -9052,9 +9058,11 @@ async def new_page( accept_downloads : Union[bool, NoneType] Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled. proxy : Union[{server: str, bypass: Union[str, NoneType], username: Union[str, NoneType], password: Union[str, NoneType]}, NoneType] - 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' } })`. + Network proxy settings to use with this context. + + > NOTE: For Chromium on Windows the 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: 'http://per-context' } })`. record_har_path : Union[pathlib.Path, str, NoneType] 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 @@ -9249,6 +9257,7 @@ async def launch( "chrome-beta", "chrome-canary", "chrome-dev", + "firefox-stable", "msedge", "msedge-beta", "msedge-canary", @@ -9304,7 +9313,7 @@ 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["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] + channel : Union["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "firefox-stable", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] Browser distribution channel. Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge). args : Union[List[str], NoneType] @@ -9383,6 +9392,7 @@ async def launch_persistent_context( "chrome-beta", "chrome-canary", "chrome-dev", + "firefox-stable", "msedge", "msedge-beta", "msedge-canary", @@ -9440,7 +9450,7 @@ 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["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] + channel : Union["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "firefox-stable", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] Browser distribution channel. Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge). executable_path : Union[pathlib.Path, str, NoneType] diff --git a/playwright/sync_api/_generated.py b/playwright/sync_api/_generated.py index f4c244b0f..4efe1fbee 100644 --- a/playwright/sync_api/_generated.py +++ b/playwright/sync_api/_generated.py @@ -782,6 +782,7 @@ def type(self, text: str, *, delay: float = None) -> NoneType: ``` > NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case. + > NOTE: For characters that are not on a US keyboard, only an `input` event will be sent. Parameters ---------- @@ -6190,6 +6191,9 @@ def emulate_media( ) -> NoneType: """Page.emulate_media + This method changes the `CSS media type` through the `media` argument, and/or the `'prefers-colors-scheme'` media + feature, using the `colorScheme` argument. + ```py page.evaluate(\"matchMedia('screen').matches\") # → True @@ -8853,9 +8857,11 @@ def new_context( accept_downloads : Union[bool, NoneType] Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled. proxy : Union[{server: str, bypass: Union[str, NoneType], username: Union[str, NoneType], password: Union[str, NoneType]}, NoneType] - 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' } })`. + Network proxy settings to use with this context. + + > NOTE: For Chromium on Windows the 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: 'http://per-context' } })`. record_har_path : Union[pathlib.Path, str, NoneType] 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 @@ -8998,9 +9004,11 @@ def new_page( accept_downloads : Union[bool, NoneType] Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled. proxy : Union[{server: str, bypass: Union[str, NoneType], username: Union[str, NoneType], password: Union[str, NoneType]}, NoneType] - 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' } })`. + Network proxy settings to use with this context. + + > NOTE: For Chromium on Windows the 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: 'http://per-context' } })`. record_har_path : Union[pathlib.Path, str, NoneType] 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 @@ -9195,6 +9203,7 @@ def launch( "chrome-beta", "chrome-canary", "chrome-dev", + "firefox-stable", "msedge", "msedge-beta", "msedge-canary", @@ -9250,7 +9259,7 @@ 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["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] + channel : Union["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "firefox-stable", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] Browser distribution channel. Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge). args : Union[List[str], NoneType] @@ -9329,6 +9338,7 @@ def launch_persistent_context( "chrome-beta", "chrome-canary", "chrome-dev", + "firefox-stable", "msedge", "msedge-beta", "msedge-canary", @@ -9386,7 +9396,7 @@ 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["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] + channel : Union["chrome", "chrome-beta", "chrome-canary", "chrome-dev", "firefox-stable", "msedge", "msedge-beta", "msedge-canary", "msedge-dev", NoneType] Browser distribution channel. Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge). executable_path : Union[pathlib.Path, str, NoneType] diff --git a/scripts/expected_api_mismatch.txt b/scripts/expected_api_mismatch.txt index bd2be231c..5fa814272 100644 --- a/scripts/expected_api_mismatch.txt +++ b/scripts/expected_api_mismatch.txt @@ -16,3 +16,7 @@ Parameter type mismatch in Page.unroute(handler=): documented as Union[Callable[ # Get vs set cookies Parameter type mismatch in BrowserContext.storage_state(return=): documented as {cookies: List[{name: str, value: str, domain: str, path: str, expires: float, httpOnly: bool, secure: bool, sameSite: Union["Lax", "None", "Strict"]}], origins: List[{origin: str, localStorage: List[{name: str, value: str}]}]}, code has {cookies: Union[List[{name: str, value: str, url: Union[str, NoneType], domain: Union[str, NoneType], path: Union[str, NoneType], expires: Union[float, NoneType], httpOnly: Union[bool, NoneType], secure: Union[bool, NoneType], sameSite: Union["Lax", "None", "Strict", NoneType]}], NoneType], origins: Union[List[{origin: str, localStorage: List[{name: str, value: str}]}], NoneType]} Parameter type mismatch in BrowserContext.cookies(return=): documented as List[{name: str, value: str, domain: str, path: str, expires: float, httpOnly: bool, secure: bool, sameSite: Union["Lax", "None", "Strict"]}], code has List[{name: str, value: str, url: Union[str, NoneType], domain: Union[str, NoneType], path: Union[str, NoneType], expires: Union[float, NoneType], httpOnly: Union[bool, NoneType], secure: Union[bool, NoneType], sameSite: Union["Lax", "None", "Strict", NoneType]}] +# Temporary Fix +Method not implemented: Error.name +Method not implemented: Error.stack +Method not implemented: Error.message diff --git a/setup.py b/setup.py index fcbc398b7..2cefc5271 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ InWheel = None from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand -driver_version = "1.11.0-next-1619452681000" +driver_version = "1.11.0-next-1620085974000" def extractall(zip: zipfile.ZipFile, path: str) -> None: diff --git a/tests/async/test_navigation.py b/tests/async/test_navigation.py index 8ad93dbe5..aea79801e 100644 --- a/tests/async/test_navigation.py +++ b/tests/async/test_navigation.py @@ -969,7 +969,7 @@ def expect_ssl_error(error_message: str, browser_name: str) -> None: if sys.platform == "darwin": assert "The certificate for this server is invalid" in error_message elif sys.platform == "win32": - assert "SSL connect error" in error_message + assert "SSL peer certificate or SSH remote key was not OK" in error_message else: assert "Unacceptable TLS certificate" in error_message else: diff --git a/tests/async/test_page.py b/tests/async/test_page.py index edf964859..d68688ee4 100644 --- a/tests/async/test_page.py +++ b/tests/async/test_page.py @@ -58,8 +58,8 @@ async def test_close_should_run_beforeunload_if_asked_for( assert dialog.message == "Leave?" else: assert ( - dialog.message - == "This page is asking you to confirm that you want to leave — information you’ve entered may not be saved." + "This page is asking you to confirm that you want to leave" + in dialog.message ) async with page.expect_event("close"): await dialog.accept()