Skip to content

Commit 75931ee

Browse files
authored
feat(roll): roll Playwright 1.16.0-next-1634054506000 (microsoft#944)
1 parent 287d820 commit 75931ee

File tree

10 files changed

+39
-25
lines changed

10 files changed

+39
-25
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
44

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->96.0.4659.0<!-- GEN:stop --> ||||
8-
| WebKit <!-- GEN:webkit-version -->15.0<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->97.0.4666.0<!-- GEN:stop --> ||||
8+
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> ||||
99
| Firefox <!-- GEN:firefox-version -->92.0<!-- GEN:stop --> ||||
1010

1111
## Documentation

playwright/_impl/_api_structures.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@
2929

3030

3131
class Cookie(TypedDict, total=False):
32+
name: str
33+
value: str
34+
domain: str
35+
path: str
36+
expires: float
37+
httpOnly: bool
38+
secure: bool
39+
sameSite: Literal["Lax", "None", "Strict"]
40+
41+
42+
class SetCookieParam(TypedDict, total=False):
3243
name: str
3344
value: str
3445
url: Optional[str]
@@ -88,8 +99,8 @@ class ProxySettings(TypedDict, total=False):
8899

89100

90101
class StorageState(TypedDict, total=False):
91-
cookies: Optional[List[Cookie]]
92-
origins: Optional[List[OriginState]]
102+
cookies: List[Cookie]
103+
origins: List[OriginState]
93104

94105

95106
class ResourceTiming(TypedDict):

playwright/_impl/_browser_context.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@
1919
from types import SimpleNamespace
2020
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Union, cast
2121

22-
from playwright._impl._api_structures import Cookie, Geolocation, StorageState
22+
from playwright._impl._api_structures import (
23+
Cookie,
24+
Geolocation,
25+
SetCookieParam,
26+
StorageState,
27+
)
2328
from playwright._impl._api_types import Error
2429
from playwright._impl._artifact import Artifact
2530
from playwright._impl._cdp_session import CDPSession
@@ -200,7 +205,7 @@ async def cookies(self, urls: Union[str, List[str]] = None) -> List[Cookie]:
200205
urls = [urls]
201206
return await self._channel.send("cookies", dict(urls=urls))
202207

203-
async def add_cookies(self, cookies: List[Cookie]) -> None:
208+
async def add_cookies(self, cookies: List[SetCookieParam]) -> None:
204209
await self._channel.send("addCookies", dict(cookies=cookies))
205210

206211
async def clear_cookies(self) -> None:

playwright/_impl/_network.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,7 @@ async def header_value(self, name: str) -> Optional[str]:
160160
async def _actual_headers(self) -> "RawHeaders":
161161
if not self._all_headers_future:
162162
self._all_headers_future = asyncio.Future()
163-
response = await self.response()
164-
if not response:
165-
return self._provisional_headers
166-
headers = await response._channel.send("rawRequestHeaders")
163+
headers = await self._channel.send("rawRequestHeaders")
167164
self._all_headers_future.set_result(RawHeaders(headers))
168165
return await self._all_headers_future
169166

playwright/async_api/_generated.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
RequestSizes,
3838
ResourceTiming,
3939
SecurityDetails,
40+
SetCookieParam,
4041
SourceLocation,
4142
StorageState,
4243
ViewportSize,
@@ -10091,7 +10092,7 @@ async def cookies(
1009110092

1009210093
Returns
1009310094
-------
10094-
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]}]
10095+
List[{name: str, value: str, domain: str, path: str, expires: float, httpOnly: bool, secure: bool, sameSite: Union["Lax", "None", "Strict"]}]
1009510096
"""
1009610097

1009710098
return mapping.from_impl_list(
@@ -10100,7 +10101,7 @@ async def cookies(
1010010101
)
1010110102
)
1010210103

10103-
async def add_cookies(self, cookies: typing.List[Cookie]) -> NoneType:
10104+
async def add_cookies(self, cookies: typing.List[SetCookieParam]) -> NoneType:
1010410105
"""BrowserContext.add_cookies
1010510106

1010610107
Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be
@@ -10611,7 +10612,7 @@ async def storage_state(
1061110612

1061210613
Returns
1061310614
-------
10614-
{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]}
10615+
{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}]}]}
1061510616
"""
1061610617

1061710618
return mapping.from_impl(
@@ -10943,7 +10944,7 @@ async def new_context(
1094310944
Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into
1094410945
800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will
1094510946
be scaled down if necessary to fit the specified size.
10946-
storage_state : Union[pathlib.Path, str, {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]}, NoneType]
10947+
storage_state : Union[pathlib.Path, str, {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}]}]}, NoneType]
1094710948
Populates context with given storage state. This option can be used to initialize context with logged-in information
1094810949
obtained via `browser_context.storage_state()`. Either a path to the file with saved storage, or an object with
1094910950
the following fields:
@@ -11117,7 +11118,7 @@ async def new_page(
1111711118
Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into
1111811119
800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will
1111911120
be scaled down if necessary to fit the specified size.
11120-
storage_state : Union[pathlib.Path, str, {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]}, NoneType]
11121+
storage_state : Union[pathlib.Path, str, {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}]}]}, NoneType]
1112111122
Populates context with given storage state. This option can be used to initialize context with logged-in information
1112211123
obtained via `browser_context.storage_state()`. Either a path to the file with saved storage, or an object with
1112311124
the following fields:

playwright/sync_api/_generated.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
RequestSizes,
3838
ResourceTiming,
3939
SecurityDetails,
40+
SetCookieParam,
4041
SourceLocation,
4142
StorageState,
4243
ViewportSize,
@@ -9853,14 +9854,14 @@ def cookies(
98539854

98549855
Returns
98559856
-------
9856-
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]}]
9857+
List[{name: str, value: str, domain: str, path: str, expires: float, httpOnly: bool, secure: bool, sameSite: Union["Lax", "None", "Strict"]}]
98579858
"""
98589859

98599860
return mapping.from_impl_list(
98609861
self._sync("browser_context.cookies", self._impl_obj.cookies(urls=urls))
98619862
)
98629863

9863-
def add_cookies(self, cookies: typing.List[Cookie]) -> NoneType:
9864+
def add_cookies(self, cookies: typing.List[SetCookieParam]) -> NoneType:
98649865
"""BrowserContext.add_cookies
98659866

98669867
Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be
@@ -10364,7 +10365,7 @@ def storage_state(
1036410365

1036510366
Returns
1036610367
-------
10367-
{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]}
10368+
{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}]}]}
1036810369
"""
1036910370

1037010371
return mapping.from_impl(
@@ -10690,7 +10691,7 @@ def new_context(
1069010691
Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into
1069110692
800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will
1069210693
be scaled down if necessary to fit the specified size.
10693-
storage_state : Union[pathlib.Path, str, {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]}, NoneType]
10694+
storage_state : Union[pathlib.Path, str, {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}]}]}, NoneType]
1069410695
Populates context with given storage state. This option can be used to initialize context with logged-in information
1069510696
obtained via `browser_context.storage_state()`. Either a path to the file with saved storage, or an object with
1069610697
the following fields:
@@ -10864,7 +10865,7 @@ def new_page(
1086410865
Dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into
1086510866
800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will
1086610867
be scaled down if necessary to fit the specified size.
10867-
storage_state : Union[pathlib.Path, str, {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]}, NoneType]
10868+
storage_state : Union[pathlib.Path, str, {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}]}]}, NoneType]
1086810869
Populates context with given storage state. This option can be used to initialize context with logged-in information
1086910870
obtained via `browser_context.storage_state()`. Either a path to the file with saved storage, or an object with
1087010871
the following fields:

scripts/expected_api_mismatch.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ Parameter type mismatch in BrowserContext.unroute(handler=): documented as Union
1313
Parameter type mismatch in Page.route(handler=): documented as Callable[[Route, Request], Any], code has Union[Callable[[Route, Request], Any], Callable[[Route], Any]]
1414
Parameter type mismatch in Page.unroute(handler=): documented as Union[Callable[[Route, Request], Any], NoneType], code has Union[Callable[[Route, Request], Any], Callable[[Route], Any], NoneType]
1515

16-
# Get vs set cookies
17-
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]}
18-
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]}]
1916
# Temporary Fix
2017
Method not implemented: Error.name
2118
Method not implemented: Error.stack

scripts/generate_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def return_value(value: Any) -> List[str]:
217217
218218
219219
from playwright._impl._accessibility import Accessibility as AccessibilityImpl
220-
from playwright._impl._api_structures import Cookie, FloatRect, FilePayload, Geolocation, HttpCredentials, PdfMargins, Position, ProxySettings, ResourceTiming, SourceLocation, StorageState, ViewportSize, RemoteAddr, SecurityDetails, RequestSizes, NameValue
220+
from playwright._impl._api_structures import Cookie, SetCookieParam, FloatRect, FilePayload, Geolocation, HttpCredentials, PdfMargins, Position, ProxySettings, ResourceTiming, SourceLocation, StorageState, ViewportSize, RemoteAddr, SecurityDetails, RequestSizes, NameValue
221221
from playwright._impl._browser import Browser as BrowserImpl
222222
from playwright._impl._browser_context import BrowserContext as BrowserContextImpl
223223
from playwright._impl._browser_type import BrowserType as BrowserTypeImpl

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
InWheel = None
2929
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand
3030

31-
driver_version = "1.16.0-next-1633339886000"
31+
driver_version = "1.16.0-next-1634054506000"
3232

3333

3434
def extractall(zip: zipfile.ZipFile, path: str) -> None:

tests/async/test_network.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
async def test_request_fulfill(page, server):
2828
async def handle_request(route: Route, request: Request):
29+
headers = await route.request.all_headers()
30+
assert headers["accept"]
2931
assert route.request == request
3032
assert repr(route) == f"<Route request={route.request}>"
3133
assert "empty.html" in request.url

0 commit comments

Comments
 (0)