@@ -268,7 +268,9 @@ def timing(self) -> ResourceTiming:
268
268
def headers(self) -> typing.Dict[str, str]:
269
269
"""Request.headers
270
270
271
- **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use `request.all_headers()` instead.
271
+ An object with the request HTTP headers. The header names are lower-cased. Note that this method does not return
272
+ security-related headers, including cookie-related ones. You can use `request.all_headers()` for complete list of
273
+ headers that include `cookie` information.
272
274
273
275
Returns
274
276
-------
@@ -411,7 +413,9 @@ def status_text(self) -> str:
411
413
def headers(self) -> typing.Dict[str, str]:
412
414
"""Response.headers
413
415
414
- **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use `response.all_headers()` instead.
416
+ An object with the response HTTP headers. The header names are lower-cased. Note that this method does not return
417
+ security-related headers, including cookie-related ones. You can use `response.all_headers()` for complete list
418
+ of headers that include `cookie` information.
415
419
416
420
Returns
417
421
-------
@@ -7736,6 +7740,43 @@ async def unroute(
7736
7740
)
7737
7741
)
7738
7742
7743
+ async def route_from_har(
7744
+ self,
7745
+ har: typing.Union[pathlib.Path, str],
7746
+ *,
7747
+ url: typing.Union[str, typing.Pattern, typing.Callable[[str], bool]] = None,
7748
+ not_found: Literal["abort", "fallback"] = None
7749
+ ) -> NoneType:
7750
+ """Page.route_from_har
7751
+
7752
+ If specified the network requests that are made in the page will be served from the HAR file. Read more about
7753
+ [Replaying from HAR](https://playwright.dev/python/docs/network#replaying-from-har).
7754
+
7755
+ Playwright will not serve requests intercepted by Service Worker from the HAR file. See
7756
+ [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
7757
+ request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
7758
+
7759
+ Parameters
7760
+ ----------
7761
+ har : Union[pathlib.Path, str]
7762
+ Path to a [HAR](http://www.softwareishard.com/blog/har-12-spec) file with prerecorded network data. If `path` is a
7763
+ relative path, then it is resolved relative to the current working directory.
7764
+ url : Union[Callable[[str], bool], Pattern, str, NoneType]
7765
+ A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
7766
+ will be surved from the HAR file. If not specified, all requests are served from the HAR file.
7767
+ not_found : Union["abort", "fallback", NoneType]
7768
+ - If set to 'abort' any request not found in the HAR file will be aborted.
7769
+ - If set to 'fallback' missing requests will be sent to the network.
7770
+
7771
+ Defaults to abort.
7772
+ """
7773
+
7774
+ return mapping.from_maybe_impl(
7775
+ await self._impl_obj.route_from_har(
7776
+ har=har, url=self._wrap_handler(url), not_found=not_found
7777
+ )
7778
+ )
7779
+
7739
7780
async def screenshot(
7740
7781
self,
7741
7782
*,
@@ -10432,6 +10473,43 @@ async def unroute(
10432
10473
)
10433
10474
)
10434
10475
10476
+ async def route_from_har(
10477
+ self,
10478
+ har: typing.Union[pathlib.Path, str],
10479
+ *,
10480
+ url: typing.Union[str, typing.Pattern, typing.Callable[[str], bool]] = None,
10481
+ not_found: Literal["abort", "fallback"] = None
10482
+ ) -> NoneType:
10483
+ """BrowserContext.route_from_har
10484
+
10485
+ If specified the network requests that are made in the context will be served from the HAR file. Read more about
10486
+ [Replaying from HAR](https://playwright.dev/python/docs/network#replaying-from-har).
10487
+
10488
+ Playwright will not serve requests intercepted by Service Worker from the HAR file. See
10489
+ [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using
10490
+ request interception by setting `Browser.newContext.serviceWorkers` to `'block'`.
10491
+
10492
+ Parameters
10493
+ ----------
10494
+ har : Union[pathlib.Path, str]
10495
+ Path to a [HAR](http://www.softwareishard.com/blog/har-12-spec) file with prerecorded network data. If `path` is a
10496
+ relative path, then it is resolved relative to the current working directory.
10497
+ url : Union[Callable[[str], bool], Pattern, str, NoneType]
10498
+ A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern
10499
+ will be surved from the HAR file. If not specified, all requests are served from the HAR file.
10500
+ not_found : Union["abort", "fallback", NoneType]
10501
+ - If set to 'abort' any request not found in the HAR file will be aborted.
10502
+ - If set to 'fallback' falls through to the next route handler in the handler chain.
10503
+
10504
+ Defaults to abort.
10505
+ """
10506
+
10507
+ return mapping.from_maybe_impl(
10508
+ await self._impl_obj.route_from_har(
10509
+ har=har, url=self._wrap_handler(url), not_found=not_found
10510
+ )
10511
+ )
10512
+
10435
10513
def expect_event(
10436
10514
self, event: str, predicate: typing.Callable = None, *, timeout: float = None
10437
10515
) -> AsyncEventContextManager:
0 commit comments