Skip to content

Commit 4fda29c

Browse files
authored
chore: roll to Playwright ToT (microsoft#1576)
1 parent 8f55a0e commit 4fda29c

File tree

13 files changed

+2970
-222
lines changed

13 files changed

+2970
-222
lines changed

README.md

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

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->106.0.5249.30<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->107.0.5304.18<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->16.0<!-- GEN:stop --> ||||
9-
| Firefox <!-- GEN:firefox-version -->104.0<!-- GEN:stop --> ||||
9+
| Firefox <!-- GEN:firefox-version -->105.0.1<!-- GEN:stop --> ||||
1010

1111
## Documentation
1212

playwright/_impl/_browser_context.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,7 @@ def _on_request_failed(
450450
page: Optional[Page],
451451
) -> None:
452452
request._failure_text = failure_text
453-
if request._timing:
454-
request._timing["responseEnd"] = response_end_timing
453+
request._set_response_end_timing(response_end_timing)
455454
self.emit(BrowserContext.Events.RequestFailed, request)
456455
if page:
457456
page.emit(Page.Events.RequestFailed, request)
@@ -463,8 +462,7 @@ def _on_request_finished(
463462
response_end_timing: float,
464463
page: Optional[Page],
465464
) -> None:
466-
if request._timing:
467-
request._timing["responseEnd"] = response_end_timing
465+
request._set_response_end_timing(response_end_timing)
468466
self.emit(BrowserContext.Events.RequestFinished, request)
469467
if page:
470468
page.emit(Page.Events.RequestFinished, request)

playwright/_impl/_fetch.py

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
from playwright._impl._playwright import Playwright
4949

5050

51+
FormType = Dict[str, Union[bool, float, str]]
52+
DataType = Union[Any, bytes, str]
53+
MultipartType = Dict[str, Union[bytes, bool, float, str, FilePayload]]
54+
ParamsType = Dict[str, Union[bool, float, str]]
55+
56+
5157
class APIRequest:
5258
def __init__(self, playwright: "Playwright") -> None:
5359
self.playwright = playwright
@@ -94,11 +100,11 @@ async def dispose(self) -> None:
94100
async def delete(
95101
self,
96102
url: str,
97-
params: Dict[str, Union[bool, float, str]] = None,
103+
params: ParamsType = None,
98104
headers: Headers = None,
99-
data: Union[Any, bytes, str] = None,
100-
form: Dict[str, Union[bool, float, str]] = None,
101-
multipart: Dict[str, Union[bytes, bool, float, str, FilePayload]] = None,
105+
data: DataType = None,
106+
form: FormType = None,
107+
multipart: MultipartType = None,
102108
timeout: float = None,
103109
failOnStatusCode: bool = None,
104110
ignoreHTTPSErrors: bool = None,
@@ -121,8 +127,11 @@ async def delete(
121127
async def head(
122128
self,
123129
url: str,
124-
params: Dict[str, Union[bool, float, str]] = None,
130+
params: ParamsType = None,
125131
headers: Headers = None,
132+
data: DataType = None,
133+
form: FormType = None,
134+
multipart: MultipartType = None,
126135
timeout: float = None,
127136
failOnStatusCode: bool = None,
128137
ignoreHTTPSErrors: bool = None,
@@ -133,6 +142,9 @@ async def head(
133142
method="HEAD",
134143
params=params,
135144
headers=headers,
145+
data=data,
146+
form=form,
147+
multipart=multipart,
136148
timeout=timeout,
137149
failOnStatusCode=failOnStatusCode,
138150
ignoreHTTPSErrors=ignoreHTTPSErrors,
@@ -142,8 +154,11 @@ async def head(
142154
async def get(
143155
self,
144156
url: str,
145-
params: Dict[str, Union[bool, float, str]] = None,
157+
params: ParamsType = None,
146158
headers: Headers = None,
159+
data: DataType = None,
160+
form: FormType = None,
161+
multipart: MultipartType = None,
147162
timeout: float = None,
148163
failOnStatusCode: bool = None,
149164
ignoreHTTPSErrors: bool = None,
@@ -154,6 +169,9 @@ async def get(
154169
method="GET",
155170
params=params,
156171
headers=headers,
172+
data=data,
173+
form=form,
174+
multipart=multipart,
157175
timeout=timeout,
158176
failOnStatusCode=failOnStatusCode,
159177
ignoreHTTPSErrors=ignoreHTTPSErrors,
@@ -163,10 +181,10 @@ async def get(
163181
async def patch(
164182
self,
165183
url: str,
166-
params: Dict[str, Union[bool, float, str]] = None,
184+
params: ParamsType = None,
167185
headers: Headers = None,
168-
data: Union[Any, bytes, str] = None,
169-
form: Dict[str, Union[bool, float, str]] = None,
186+
data: DataType = None,
187+
form: FormType = None,
170188
multipart: Dict[str, Union[bytes, bool, float, str, FilePayload]] = None,
171189
timeout: float = None,
172190
failOnStatusCode: bool = None,
@@ -190,10 +208,10 @@ async def patch(
190208
async def put(
191209
self,
192210
url: str,
193-
params: Dict[str, Union[bool, float, str]] = None,
211+
params: ParamsType = None,
194212
headers: Headers = None,
195-
data: Union[Any, bytes, str] = None,
196-
form: Dict[str, Union[bool, float, str]] = None,
213+
data: DataType = None,
214+
form: FormType = None,
197215
multipart: Dict[str, Union[bytes, bool, float, str, FilePayload]] = None,
198216
timeout: float = None,
199217
failOnStatusCode: bool = None,
@@ -217,10 +235,10 @@ async def put(
217235
async def post(
218236
self,
219237
url: str,
220-
params: Dict[str, Union[bool, float, str]] = None,
238+
params: ParamsType = None,
221239
headers: Headers = None,
222-
data: Union[Any, bytes, str] = None,
223-
form: Dict[str, Union[bool, float, str]] = None,
240+
data: DataType = None,
241+
form: FormType = None,
224242
multipart: Dict[str, Union[bytes, bool, float, str, FilePayload]] = None,
225243
timeout: float = None,
226244
failOnStatusCode: bool = None,
@@ -244,11 +262,11 @@ async def post(
244262
async def fetch(
245263
self,
246264
urlOrRequest: Union[str, network.Request],
247-
params: Dict[str, Union[bool, float, str]] = None,
265+
params: ParamsType = None,
248266
method: str = None,
249267
headers: Headers = None,
250-
data: Union[Any, bytes, str] = None,
251-
form: Dict[str, Union[bool, float, str]] = None,
268+
data: DataType = None,
269+
form: FormType = None,
252270
multipart: Dict[str, Union[bytes, bool, float, str, FilePayload]] = None,
253271
timeout: float = None,
254272
failOnStatusCode: bool = None,

playwright/_impl/_frame.py

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@
4545
parse_result,
4646
serialize_argument,
4747
)
48-
from playwright._impl._locator import FrameLocator, Locator
48+
from playwright._impl._locator import (
49+
FrameLocator,
50+
Locator,
51+
get_by_alt_text_selector,
52+
get_by_label_selector,
53+
get_by_placeholder_selector,
54+
get_by_role_selector,
55+
get_by_test_id_selector,
56+
get_by_text_selector,
57+
get_by_title_selector,
58+
)
4959
from playwright._impl._network import Response
5060
from playwright._impl._set_input_files_helpers import convert_input_files
5161
from playwright._impl._wait_helper import WaitHelper
@@ -520,6 +530,60 @@ def locator(
520530
) -> Locator:
521531
return Locator(self, selector, has_text=has_text, has=has)
522532

533+
def get_by_alt_text(
534+
self, text: Union[str, Pattern[str]], exact: bool = None
535+
) -> "Locator":
536+
return self.locator(get_by_alt_text_selector(text, exact=exact))
537+
538+
def get_by_label(
539+
self, text: Union[str, Pattern[str]], exact: bool = None
540+
) -> "Locator":
541+
return self.locator(get_by_label_selector(text, exact=exact))
542+
543+
def get_by_placeholder(
544+
self, text: Union[str, Pattern[str]], exact: bool = None
545+
) -> "Locator":
546+
return self.locator(get_by_placeholder_selector(text, exact=exact))
547+
548+
def get_by_role(
549+
self,
550+
role: str,
551+
checked: bool = None,
552+
disabled: bool = None,
553+
expanded: bool = None,
554+
includeHidden: bool = None,
555+
level: int = None,
556+
name: Union[str, Pattern[str]] = None,
557+
pressed: bool = None,
558+
selected: bool = None,
559+
) -> "Locator":
560+
return self.locator(
561+
get_by_role_selector(
562+
role,
563+
checked=checked,
564+
disabled=disabled,
565+
expanded=expanded,
566+
includeHidden=includeHidden,
567+
level=level,
568+
name=name,
569+
pressed=pressed,
570+
selected=selected,
571+
)
572+
)
573+
574+
def get_by_test_id(self, testId: str) -> "Locator":
575+
return self.locator(get_by_test_id_selector(testId))
576+
577+
def get_by_text(
578+
self, text: Union[str, Pattern[str]], exact: bool = None
579+
) -> "Locator":
580+
return self.locator(get_by_text_selector(text, exact=exact))
581+
582+
def get_by_title(
583+
self, text: Union[str, Pattern[str]], exact: bool = None
584+
) -> "Locator":
585+
return self.locator(get_by_title_selector(text, exact=exact))
586+
523587
def frame_locator(self, selector: str) -> FrameLocator:
524588
return FrameLocator(self, selector)
525589

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