Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->91.0.4469.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit <!-- GEN:webkit-version -->14.2<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->88.0b8<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->89.0b2<!-- GEN:stop --> | ✅ | ✅ | ✅ |

Headless execution is supported for all browsers on all platforms.

Expand Down
8 changes: 4 additions & 4 deletions local-requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions playwright/_impl/_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"chrome-beta",
"chrome-canary",
"chrome-dev",
"firefox-stable",
"msedge",
"msedge-beta",
"msedge-canary",
Expand Down
26 changes: 18 additions & 8 deletions playwright/async_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -9249,6 +9257,7 @@ async def launch(
"chrome-beta",
"chrome-canary",
"chrome-dev",
"firefox-stable",
"msedge",
"msedge-beta",
"msedge-canary",
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -9383,6 +9392,7 @@ async def launch_persistent_context(
"chrome-beta",
"chrome-canary",
"chrome-dev",
"firefox-stable",
"msedge",
"msedge-beta",
"msedge-canary",
Expand Down Expand Up @@ -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]
Expand Down
26 changes: 18 additions & 8 deletions playwright/sync_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -9195,6 +9203,7 @@ def launch(
"chrome-beta",
"chrome-canary",
"chrome-dev",
"firefox-stable",
"msedge",
"msedge-beta",
"msedge-canary",
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -9329,6 +9338,7 @@ def launch_persistent_context(
"chrome-beta",
"chrome-canary",
"chrome-dev",
"firefox-stable",
"msedge",
"msedge-beta",
"msedge-canary",
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions scripts/expected_api_mismatch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/async/test_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/async/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down