Skip to content

Commit 8acdb2d

Browse files
committed
chore: roll to Playwright 1.27
1 parent be076b7 commit 8acdb2d

File tree

9 files changed

+795
-31
lines changed

9 files changed

+795
-31
lines changed

playwright/_impl/_api_structures.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,89 @@ class FrameExpectResult(TypedDict):
196196
matches: bool
197197
received: Any
198198
log: List[str]
199+
200+
201+
AriaRole = Literal[
202+
"alert",
203+
"alertdialog",
204+
"application",
205+
"article",
206+
"banner",
207+
"blockquote",
208+
"button",
209+
"caption",
210+
"cell",
211+
"checkbox",
212+
"code",
213+
"columnheader",
214+
"combobox",
215+
"complementary",
216+
"contentinfo",
217+
"definition",
218+
"deletion",
219+
"dialog",
220+
"directory",
221+
"document",
222+
"emphasis",
223+
"feed",
224+
"figure",
225+
"form",
226+
"generic",
227+
"grid",
228+
"gridcell",
229+
"group",
230+
"heading",
231+
"img",
232+
"insertion",
233+
"link",
234+
"list",
235+
"listbox",
236+
"listitem",
237+
"log",
238+
"main",
239+
"marquee",
240+
"math",
241+
"menu",
242+
"menubar",
243+
"menuitem",
244+
"menuitemcheckbox",
245+
"menuitemradio",
246+
"meter",
247+
"navigation",
248+
"none",
249+
"note",
250+
"option",
251+
"paragraph",
252+
"presentation",
253+
"progressbar",
254+
"radio",
255+
"radiogroup",
256+
"region",
257+
"row",
258+
"rowgroup",
259+
"rowheader",
260+
"scrollbar",
261+
"search",
262+
"searchbox",
263+
"separator",
264+
"slider",
265+
"spinbutton",
266+
"status",
267+
"strong",
268+
"subscript",
269+
"superscript",
270+
"switch",
271+
"tab",
272+
"table",
273+
"tablist",
274+
"tabpanel",
275+
"term",
276+
"textbox",
277+
"time",
278+
"timer",
279+
"toolbar",
280+
"tooltip",
281+
"tree",
282+
"treegrid",
283+
"treeite",
284+
]

playwright/_impl/_frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from pyee import EventEmitter
2121

22-
from playwright._impl._api_structures import FilePayload, Position
22+
from playwright._impl._api_structures import AriaRole, FilePayload, Position
2323
from playwright._impl._api_types import Error
2424
from playwright._impl._connection import (
2525
ChannelOwner,
@@ -547,7 +547,7 @@ def get_by_placeholder(
547547

548548
def get_by_role(
549549
self,
550-
role: str,
550+
role: AriaRole,
551551
checked: bool = None,
552552
disabled: bool = None,
553553
expanded: bool = None,

playwright/_impl/_locator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
)
3131

3232
from playwright._impl._api_structures import (
33+
AriaRole,
3334
FilePayload,
3435
FloatRect,
3536
FrameExpectOptions,
@@ -229,7 +230,7 @@ def get_by_placeholder(
229230

230231
def get_by_role(
231232
self,
232-
role: str,
233+
role: AriaRole,
233234
checked: bool = None,
234235
disabled: bool = None,
235236
expanded: bool = None,
@@ -664,7 +665,7 @@ def get_by_placeholder(
664665

665666
def get_by_role(
666667
self,
667-
role: str,
668+
role: AriaRole,
668669
checked: bool = None,
669670
disabled: bool = None,
670671
expanded: bool = None,
@@ -739,8 +740,7 @@ def get_by_attribute_text_selector(
739740
) -> str:
740741
if isinstance(text, Pattern):
741742
return f"internal:attr=[{attr_name}=/{text.pattern}/{escape_regex_flags(text)}]"
742-
suffix = "s" if exact else "i"
743-
return f"internal:attr=[{attr_name}={escape_for_attribute_selector(text)}{suffix}]"
743+
return f"internal:attr=[{attr_name}={escape_for_attribute_selector(text, exact=exact)}]"
744744

745745

746746
def get_by_label_selector(text: Union[str, Pattern[str]], exact: bool = None) -> str:
@@ -766,7 +766,7 @@ def get_by_text_selector(text: Union[str, Pattern[str]], exact: bool = None) ->
766766

767767

768768
def get_by_role_selector(
769-
role: str,
769+
role: AriaRole,
770770
checked: bool = None,
771771
disabled: bool = None,
772772
expanded: bool = None,

playwright/_impl/_page.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from playwright._impl._accessibility import Accessibility
3535
from playwright._impl._api_structures import (
36+
AriaRole,
3637
FilePayload,
3738
FloatRect,
3839
PdfMargins,
@@ -752,7 +753,7 @@ def get_by_placeholder(
752753

753754
def get_by_role(
754755
self,
755-
role: str,
756+
role: AriaRole,
756757
checked: bool = None,
757758
disabled: bool = None,
758759
expanded: bool = None,

playwright/_impl/_str_utils.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ def escape_for_text_selector(
5151
return text
5252

5353

54-
def escape_for_attribute_selector(value: str) -> str:
55-
# TODO: this should actually be
56-
# cssEscape(value).replace(/\\ /g, ' ')
57-
# However, our attribute selectors do not conform to CSS parsing spec,
58-
# so we escape them differently.
59-
return '"' + value.replace('"', '\\"') + '"'
54+
def escape_for_attribute_selector(value: str, exact: bool = None) -> str:
55+
suffix = "" if exact else "i"
56+
return '"' + value.replace('"', '\\"') + '"' + suffix

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy