Skip to content

Commit b3b4531

Browse files
authored
feat(roll): roll Playwright 1.3.0-next.1598476714110 (#180)
1 parent 289e8e1 commit b3b4531

23 files changed

+79
-346
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 🎭 [Playwright](https://github.com/microsoft/playwright) for Python
22

3-
[![PyPI version](https://badge.fury.io/py/playwright.svg)](https://pypi.python.org/pypi/playwright/) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/playwright.svg)](https://pypi.python.org/pypi/playwright/) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-86.0.4217.0-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-79.0a1-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> [![WebKit version](https://img.shields.io/badge/webkit-14.0-blue.svg?logo=safari)](https://webkit.org/)
3+
[![PyPI version](https://badge.fury.io/py/playwright.svg)](https://pypi.python.org/pypi/playwright/) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/playwright.svg)](https://pypi.python.org/pypi/playwright/) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-86.0.4217.0-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-80.0b8-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> [![WebKit version](https://img.shields.io/badge/webkit-14.0-blue.svg?logo=safari)](https://webkit.org/)
44

55
##### [Docs](#documentation) | [API reference](https://playwright.dev/#?path=docs/api.md) | [Docstrings](https://github.com/microsoft/playwright-python/blob/master/playwright/sync_api.py)
66

@@ -10,7 +10,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
1010
| :--- | :---: | :---: | :---: |
1111
| Chromium <!-- GEN:chromium-version -->86.0.4217.0<!-- GEN:stop --> ||||
1212
| WebKit 14.0 ||||
13-
| Firefox <!-- GEN:firefox-version -->79.0a1<!-- GEN:stop --> ||||
13+
| Firefox <!-- GEN:firefox-version -->80.0b8<!-- GEN:stop --> ||||
1414

1515
Headless execution is supported for all the browsers on all platforms.
1616

driver/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ const util = require('util');
3535
return;
3636
}
3737

38-
require('playwright/lib/rpc/server');
38+
require('playwright/lib/server');
3939
})();

driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"license": "Apache-2.0",
1515
"dependencies": {
16-
"playwright": "1.3.0-next.1596843106133"
16+
"playwright": "1.3.0-next.1598476714110"
1717
},
1818
"devDependencies": {
1919
"pkg": "^4.4.9"

playwright/async_api.py

Lines changed: 5 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from playwright.async_base import AsyncBase, AsyncEventContextManager, mapping
2727
from playwright.browser import Browser as BrowserImpl
2828
from playwright.browser_context import BrowserContext as BrowserContextImpl
29-
from playwright.browser_server import BrowserServer as BrowserServerImpl
3029
from playwright.browser_type import BrowserType as BrowserTypeImpl
3130
from playwright.cdp_session import CDPSession as CDPSessionImpl
3231
from playwright.chromium_browser_context import (
@@ -3070,6 +3069,11 @@ def workers(self) -> typing.List["Worker"]:
30703069
"""
30713070
return mapping.from_impl_list(self._impl_obj.workers)
30723071

3072+
def remove_listener(self, event: str, f: typing.Any) -> NoneType:
3073+
return mapping.from_maybe_impl(
3074+
self._impl_obj.remove_listener(event=event, f=mapping.to_impl(f))
3075+
)
3076+
30733077
async def opener(self) -> typing.Union["Page", NoneType]:
30743078
"""Page.opener
30753079
@@ -5518,45 +5522,6 @@ async def close(self) -> NoneType:
55185522
mapping.register(BrowserImpl, Browser)
55195523

55205524

5521-
class BrowserServer(AsyncBase):
5522-
def __init__(self, obj: BrowserServerImpl):
5523-
super().__init__(obj)
5524-
5525-
@property
5526-
def pid(self) -> str:
5527-
return mapping.from_maybe_impl(self._impl_obj.pid)
5528-
5529-
@property
5530-
def wsEndpoint(self) -> str:
5531-
"""BrowserServer.wsEndpoint
5532-
5533-
Browser websocket endpoint which can be used as an argument to browserType.connect(options) to establish connection to the browser.
5534-
5535-
Returns
5536-
-------
5537-
str
5538-
Browser websocket url.
5539-
"""
5540-
return mapping.from_maybe_impl(self._impl_obj.wsEndpoint)
5541-
5542-
async def kill(self) -> NoneType:
5543-
"""BrowserServer.kill
5544-
5545-
Kills the browser process and waits for the process to exit.
5546-
"""
5547-
return mapping.from_maybe_impl(await self._impl_obj.kill())
5548-
5549-
async def close(self) -> NoneType:
5550-
"""BrowserServer.close
5551-
5552-
Closes the browser gracefully and makes sure the process is terminated.
5553-
"""
5554-
return mapping.from_maybe_impl(await self._impl_obj.close())
5555-
5556-
5557-
mapping.register(BrowserServerImpl, BrowserServer)
5558-
5559-
55605525
class BrowserType(AsyncBase):
55615526
def __init__(self, obj: BrowserTypeImpl):
55625527
super().__init__(obj)
@@ -5665,82 +5630,6 @@ async def launch(
56655630
)
56665631
)
56675632

5668-
async def launchServer(
5669-
self,
5670-
executablePath: typing.Union[str, pathlib.Path] = None,
5671-
args: typing.List[str] = None,
5672-
ignoreDefaultArgs: typing.Union[bool, typing.List[str]] = None,
5673-
handleSIGINT: bool = None,
5674-
handleSIGTERM: bool = None,
5675-
handleSIGHUP: bool = None,
5676-
timeout: int = None,
5677-
env: typing.Union[typing.Dict[str, typing.Union[str, int, bool]]] = None,
5678-
headless: bool = None,
5679-
devtools: bool = None,
5680-
proxy: ProxyServer = None,
5681-
downloadsPath: typing.Union[str, pathlib.Path] = None,
5682-
port: int = None,
5683-
chromiumSandbox: bool = None,
5684-
) -> "BrowserServer":
5685-
"""BrowserType.launchServer
5686-
5687-
Launches browser server that client can connect to. An example of launching a browser executable and connecting to it later:
5688-
5689-
Parameters
5690-
----------
5691-
executablePath : Union[str, pathlib.Path, NoneType]
5692-
Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk.
5693-
args : Optional[List[str]]
5694-
Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
5695-
ignoreDefaultArgs : Union[bool, List[str], NoneType]
5696-
If `true`, then do not use any of the default arguments. If an array is given, then filter out the given default arguments. Dangerous option; use with care. Defaults to `false`.
5697-
handleSIGINT : Optional[bool]
5698-
Close the browser process on Ctrl-C. Defaults to `true`.
5699-
handleSIGTERM : Optional[bool]
5700-
Close the browser process on SIGTERM. Defaults to `true`.
5701-
handleSIGHUP : Optional[bool]
5702-
Close the browser process on SIGHUP. Defaults to `true`.
5703-
timeout : Optional[int]
5704-
Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
5705-
env : Optional[Dict[str, Union[str, int, bool]]]
5706-
Specify environment variables that will be visible to the browser. Defaults to `process.env`.
5707-
headless : Optional[bool]
5708-
Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to `true` unless the `devtools` option is `true`.
5709-
devtools : Optional[bool]
5710-
**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
5711-
proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}]
5712-
Network proxy settings.
5713-
downloadsPath : Union[str, pathlib.Path, NoneType]
5714-
If specified, accepted downloads are downloaded into this folder. Otherwise, temporary folder is created and is deleted when browser is closed.
5715-
port : Optional[int]
5716-
Port to use for the web socket. Defaults to 0 that picks any available port.
5717-
chromiumSandbox : Optional[bool]
5718-
Enable Chromium sandboxing. Defaults to `true`.
5719-
5720-
Returns
5721-
-------
5722-
BrowserServer
5723-
Promise which resolves to the browser app instance.
5724-
"""
5725-
return mapping.from_impl(
5726-
await self._impl_obj.launchServer(
5727-
executablePath=executablePath,
5728-
args=args,
5729-
ignoreDefaultArgs=ignoreDefaultArgs,
5730-
handleSIGINT=handleSIGINT,
5731-
handleSIGTERM=handleSIGTERM,
5732-
handleSIGHUP=handleSIGHUP,
5733-
timeout=timeout,
5734-
env=mapping.to_impl(env),
5735-
headless=headless,
5736-
devtools=devtools,
5737-
proxy=proxy,
5738-
downloadsPath=downloadsPath,
5739-
port=port,
5740-
chromiumSandbox=chromiumSandbox,
5741-
)
5742-
)
5743-
57445633
async def launchPersistentContext(
57455634
self,
57465635
userDataDir: typing.Union[str, pathlib.Path],

playwright/browser_server.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

playwright/browser_type.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
from playwright.browser import Browser
1919
from playwright.browser_context import BrowserContext
20-
from playwright.browser_server import BrowserServer
2120
from playwright.connection import ChannelOwner, from_channel
2221
from playwright.helper import (
2322
ColorScheme,
@@ -72,32 +71,6 @@ async def launch(
7271
raise not_installed_error(f'"{self.name}" browser was not found.')
7372
raise e
7473

75-
async def launchServer(
76-
self,
77-
executablePath: Union[str, Path] = None,
78-
args: List[str] = None,
79-
ignoreDefaultArgs: Union[bool, List[str]] = None,
80-
handleSIGINT: bool = None,
81-
handleSIGTERM: bool = None,
82-
handleSIGHUP: bool = None,
83-
timeout: int = None,
84-
env: Env = None,
85-
headless: bool = None,
86-
devtools: bool = None,
87-
proxy: ProxyServer = None,
88-
downloadsPath: Union[str, Path] = None,
89-
port: int = None,
90-
chromiumSandbox: bool = None,
91-
) -> BrowserServer:
92-
params = locals_to_params(locals())
93-
normalize_launch_params(params)
94-
try:
95-
return from_channel(await self._channel.send("launchServer", params))
96-
except Exception as e:
97-
if f"{self.name}-" in str(e):
98-
raise not_installed_error(f'"{self.name}" browser was not found.')
99-
raise e
100-
10174
async def launchPersistentContext(
10275
self,
10376
userDataDir: Union[str, Path],

playwright/cdp_session.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
from typing import Any, Dict
1616

1717
from playwright.connection import ChannelOwner
18-
from playwright.js_handle import parse_result, serialize_argument
18+
from playwright.helper import locals_to_params
19+
from playwright.js_handle import parse_result
1920

2021

2122
class CDPSession(ChannelOwner):
@@ -29,10 +30,7 @@ def _on_event(self, params: Any) -> None:
2930
self.emit(params["method"], parse_result(params["params"]))
3031

3132
async def send(self, method: str, params: Dict = None) -> Dict:
32-
payload = {"method": method}
33-
if params:
34-
payload["params"] = serialize_argument(params)["value"]
35-
result = await self._channel.send("send", payload)
33+
result = await self._channel.send("send", locals_to_params(locals()))
3634
return parse_result(result)
3735

3836
async def detach(self) -> None:

playwright/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, connection: "Connection", guid: str) -> None:
3232
self._guid = guid
3333
self._object: Optional[ChannelOwner] = None
3434

35-
async def send(self, method: str, params: dict = None) -> Any:
35+
async def send(self, method: str, params: Dict = None) -> Any:
3636
if params is None:
3737
params = {}
3838
callback = self._connection._send_message_to_server(self._guid, method, params)
@@ -48,7 +48,7 @@ async def send(self, method: str, params: dict = None) -> Any:
4848
key = next(iter(result))
4949
return result[key]
5050

51-
def send_no_reply(self, method: str, params: dict = None) -> None:
51+
def send_no_reply(self, method: str, params: Dict = None) -> None:
5252
if params is None:
5353
params = {}
5454
self._connection._send_message_to_server(self._guid, method, params)

playwright/drivers/browsers.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
},
99
{
1010
"name": "firefox",
11-
"revision": "1154",
11+
"revision": "1167",
1212
"download": true
1313
},
1414
{
1515
"name": "webkit",
16-
"revision": "1322",
16+
"revision": "1332",
1717
"download": true
1818
}
1919
]

playwright/network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,4 @@ def serialize_headers(headers: Dict[str, str]) -> List[Header]:
234234

235235

236236
def parse_headers(headers: List[Header]) -> Dict[str, str]:
237-
return {header["name"]: header["value"] for header in headers}
237+
return {header["name"].lower(): header["value"] for header in headers}

0 commit comments

Comments
 (0)