Skip to content

chore(roll): roll Playwright to 1.52.0 (omitting glob changes) #2823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 28, 2025
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->134.0.6998.35<!-- GEN:stop --> ||||
| Chromium <!-- GEN:chromium-version -->136.0.7103.25<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->18.4<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->135.0<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->137.0<!-- GEN:stop --> ||||

## Documentation

Expand Down
39 changes: 39 additions & 0 deletions playwright/_impl/_assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,45 @@ async def not_to_have_class(
__tracebackhide__ = True
await self._not.to_have_class(expected, timeout)

async def to_contain_class(
self,
expected: Union[
Sequence[str],
str,
],
timeout: float = None,
) -> None:
__tracebackhide__ = True
if isinstance(expected, collections.abc.Sequence) and not isinstance(
expected, str
):
expected_text = to_expected_text_values(expected)
await self._expect_impl(
"to.contain.class.array",
FrameExpectOptions(expectedText=expected_text, timeout=timeout),
expected,
"Locator expected to contain class names",
)
else:
expected_text = to_expected_text_values([expected])
await self._expect_impl(
"to.contain.class",
FrameExpectOptions(expectedText=expected_text, timeout=timeout),
expected,
"Locator expected to contain class",
)

async def not_to_contain_class(
self,
expected: Union[
Sequence[str],
str,
],
timeout: float = None,
) -> None:
__tracebackhide__ = True
await self._not.to_contain_class(expected, timeout)

async def to_have_count(
self,
count: int,
Expand Down
1 change: 1 addition & 0 deletions playwright/_impl/_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ async def new_context(
storageState: Union[StorageState, str, Path] = None,
clientCertificates: List[ClientCertificate] = None,
failOnStatusCode: bool = None,
maxRedirects: int = None,
) -> "APIRequestContext":
params = locals_to_params(locals())
if "storageState" in params:
Expand Down
52 changes: 52 additions & 0 deletions playwright/_impl/_js_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import base64
import collections.abc
import datetime
import math
import struct
import traceback
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
Expand Down Expand Up @@ -260,6 +262,56 @@ def parse_value(value: Any, refs: Optional[Dict[int, Any]] = None) -> Any:

if "b" in value:
return value["b"]

if "ta" in value:
encoded_bytes = value["ta"]["b"]
decoded_bytes = base64.b64decode(encoded_bytes)
array_type = value["ta"]["k"]
if array_type == "i8":
word_size = 1
fmt = "b"
elif array_type == "ui8" or array_type == "ui8c":
word_size = 1
fmt = "B"
elif array_type == "i16":
word_size = 2
fmt = "h"
elif array_type == "ui16":
word_size = 2
fmt = "H"
elif array_type == "i32":
word_size = 4
fmt = "i"
elif array_type == "ui32":
word_size = 4
fmt = "I"
elif array_type == "f32":
word_size = 4
fmt = "f"
elif array_type == "f64":
word_size = 8
fmt = "d"
elif array_type == "bi64":
word_size = 8
fmt = "q"
elif array_type == "bui64":
word_size = 8
fmt = "Q"
else:
raise ValueError(f"Unsupported array type: {array_type}")

byte_len = len(decoded_bytes)
if byte_len % word_size != 0:
raise ValueError(
f"Decoded bytes length {byte_len} is not a multiple of word size {word_size}"
)

if byte_len == 0:
return []
array_len = byte_len // word_size
# "<" denotes little-endian
format_string = f"<{array_len}{fmt}"
return list(struct.unpack(format_string, decoded_bytes))
return value


Expand Down
2 changes: 1 addition & 1 deletion playwright/_impl/_locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ async def screenshot(
),
)

async def aria_snapshot(self, timeout: float = None) -> str:
async def aria_snapshot(self, timeout: float = None, ref: bool = None) -> str:
return await self._frame._channel.send(
"ariaSnapshot",
{
Expand Down
Loading
Loading