playwright-browserstack 1.62.0__py3-none-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- playwright/__init__.py +19 -0
- playwright/__main__.py +33 -0
- playwright/_impl/__init__.py +0 -0
- playwright/_impl/__pyinstaller/__init__.py +20 -0
- playwright/_impl/__pyinstaller/hook-playwright.async_api.py +17 -0
- playwright/_impl/__pyinstaller/hook-playwright.sync_api.py +17 -0
- playwright/_impl/_android.py +704 -0
- playwright/_impl/_api_structures.py +365 -0
- playwright/_impl/_artifact.py +87 -0
- playwright/_impl/_assertions.py +1124 -0
- playwright/_impl/_async_base.py +105 -0
- playwright/_impl/_browser.py +293 -0
- playwright/_impl/_browser_context.py +754 -0
- playwright/_impl/_browser_type.py +368 -0
- playwright/_impl/_cdp_session.py +46 -0
- playwright/_impl/_clock.py +104 -0
- playwright/_impl/_connection.py +764 -0
- playwright/_impl/_console_message.py +98 -0
- playwright/_impl/_credentials.py +57 -0
- playwright/_impl/_debugger.py +54 -0
- playwright/_impl/_dialog.py +63 -0
- playwright/_impl/_disposable.py +96 -0
- playwright/_impl/_download.py +64 -0
- playwright/_impl/_driver.py +41 -0
- playwright/_impl/_element_handle.py +480 -0
- playwright/_impl/_errors.py +64 -0
- playwright/_impl/_event_context_manager.py +33 -0
- playwright/_impl/_fetch.py +626 -0
- playwright/_impl/_file_chooser.py +57 -0
- playwright/_impl/_form_data.py +34 -0
- playwright/_impl/_frame.py +985 -0
- playwright/_impl/_glob.py +65 -0
- playwright/_impl/_greenlets.py +49 -0
- playwright/_impl/_har_router.py +122 -0
- playwright/_impl/_helper.py +601 -0
- playwright/_impl/_impl_to_api_mapping.py +158 -0
- playwright/_impl/_input.py +111 -0
- playwright/_impl/_js_handle.py +336 -0
- playwright/_impl/_json_pipe.py +97 -0
- playwright/_impl/_local_utils.py +95 -0
- playwright/_impl/_locator.py +1024 -0
- playwright/_impl/_map.py +31 -0
- playwright/_impl/_network.py +1017 -0
- playwright/_impl/_object_factory.py +116 -0
- playwright/_impl/_page.py +1637 -0
- playwright/_impl/_path_utils.py +27 -0
- playwright/_impl/_playwright.py +68 -0
- playwright/_impl/_screencast.py +177 -0
- playwright/_impl/_selectors.py +67 -0
- playwright/_impl/_set_input_files_helpers.py +158 -0
- playwright/_impl/_str_utils.py +76 -0
- playwright/_impl/_stream.py +46 -0
- playwright/_impl/_sync_base.py +151 -0
- playwright/_impl/_tracing.py +281 -0
- playwright/_impl/_transport.py +184 -0
- playwright/_impl/_video.py +56 -0
- playwright/_impl/_waiter.py +197 -0
- playwright/_impl/_web_error.py +48 -0
- playwright/_impl/_web_storage.py +58 -0
- playwright/_impl/_writable_stream.py +42 -0
- playwright/_repo_version.py +24 -0
- playwright/async_api/__init__.py +275 -0
- playwright/async_api/_android_generated.py +462 -0
- playwright/async_api/_context_manager.py +57 -0
- playwright/async_api/_generated.py +23875 -0
- playwright/driver/LICENSE +2946 -0
- playwright/driver/README.md +1 -0
- playwright/driver/node.exe +0 -0
- playwright/driver/package/LICENSE +202 -0
- playwright/driver/package/NOTICE +5 -0
- playwright/driver/package/README.md +3 -0
- playwright/driver/package/ThirdPartyNotices.txt +13 -0
- playwright/driver/package/bin/install_media_pack.ps1 +5 -0
- playwright/driver/package/bin/install_webkit_wsl.ps1 +33 -0
- playwright/driver/package/bin/reinstall_chrome_beta_linux.sh +42 -0
- playwright/driver/package/bin/reinstall_chrome_beta_mac.sh +13 -0
- playwright/driver/package/bin/reinstall_chrome_beta_win.ps1 +24 -0
- playwright/driver/package/bin/reinstall_chrome_stable_linux.sh +42 -0
- playwright/driver/package/bin/reinstall_chrome_stable_mac.sh +12 -0
- playwright/driver/package/bin/reinstall_chrome_stable_win.ps1 +24 -0
- playwright/driver/package/bin/reinstall_msedge_beta_linux.sh +48 -0
- playwright/driver/package/bin/reinstall_msedge_beta_mac.sh +11 -0
- playwright/driver/package/bin/reinstall_msedge_beta_win.ps1 +23 -0
- playwright/driver/package/bin/reinstall_msedge_dev_linux.sh +48 -0
- playwright/driver/package/bin/reinstall_msedge_dev_mac.sh +11 -0
- playwright/driver/package/bin/reinstall_msedge_dev_win.ps1 +23 -0
- playwright/driver/package/bin/reinstall_msedge_stable_linux.sh +48 -0
- playwright/driver/package/bin/reinstall_msedge_stable_mac.sh +11 -0
- playwright/driver/package/bin/reinstall_msedge_stable_win.ps1 +24 -0
- playwright/driver/package/browsers.json +75 -0
- playwright/driver/package/cli.js +21 -0
- playwright/driver/package/index.d.ts +17 -0
- playwright/driver/package/index.js +17 -0
- playwright/driver/package/index.mjs +28 -0
- playwright/driver/package/lib/bootstrap.js +88 -0
- playwright/driver/package/lib/coreBundle.js +74830 -0
- playwright/driver/package/lib/entry/cliDaemon.js +5 -0
- playwright/driver/package/lib/entry/dashboardApp.js +3 -0
- playwright/driver/package/lib/entry/mcp.js +10 -0
- playwright/driver/package/lib/entry/oopBrowserDownload.js +3 -0
- playwright/driver/package/lib/package.js +50 -0
- playwright/driver/package/lib/server/chromium/appIcon.png +0 -0
- playwright/driver/package/lib/server/electron/loader.js +118 -0
- playwright/driver/package/lib/serverRegistry.js +7347 -0
- playwright/driver/package/lib/serverRegistry.js.LICENSE +354 -0
- playwright/driver/package/lib/tools/cli-client/channelSessions.js +141 -0
- playwright/driver/package/lib/tools/cli-client/cli.js +6 -0
- playwright/driver/package/lib/tools/cli-client/help.json +708 -0
- playwright/driver/package/lib/tools/cli-client/minimist.js +128 -0
- playwright/driver/package/lib/tools/cli-client/output.js +343 -0
- playwright/driver/package/lib/tools/cli-client/program.js +404 -0
- playwright/driver/package/lib/tools/cli-client/registry.js +176 -0
- playwright/driver/package/lib/tools/cli-client/session.js +258 -0
- playwright/driver/package/lib/tools/dashboard/appIcon.png +0 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/SKILL.md +420 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/running-code.md +241 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/session-management.md +225 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
- playwright/driver/package/lib/tools/skills/playwright-cli/references/video-recording.md +143 -0
- playwright/driver/package/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
- playwright/driver/package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- playwright/driver/package/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
- playwright/driver/package/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
- playwright/driver/package/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
- playwright/driver/package/lib/tools/skills/playwright-trace/SKILL.md +171 -0
- playwright/driver/package/lib/tools/utils/extension.js +101 -0
- playwright/driver/package/lib/tools/utils/socketConnection.js +108 -0
- playwright/driver/package/lib/utilsBundle.js +90764 -0
- playwright/driver/package/lib/utilsBundle.js.LICENSE +2179 -0
- playwright/driver/package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- playwright/driver/package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- playwright/driver/package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- playwright/driver/package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- playwright/driver/package/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
- playwright/driver/package/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
- playwright/driver/package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- playwright/driver/package/lib/vite/dashboard/index.html +29 -0
- playwright/driver/package/lib/vite/dashboard/playwright-logo.svg +24 -0
- playwright/driver/package/lib/vite/htmlReport/index.html +16 -0
- playwright/driver/package/lib/vite/htmlReport/report.css +2 -0
- playwright/driver/package/lib/vite/htmlReport/report.js +32 -0
- playwright/driver/package/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- playwright/driver/package/lib/vite/recorder/assets/codeMirrorModule-CwYYHbcZ.js +32 -0
- playwright/driver/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- playwright/driver/package/lib/vite/recorder/assets/index-DYjdXIbE.js +129 -0
- playwright/driver/package/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
- playwright/driver/package/lib/vite/recorder/index.html +29 -0
- playwright/driver/package/lib/vite/recorder/playwright-logo.svg +9 -0
- playwright/driver/package/lib/vite/traceViewer/assets/codeMirrorModule-By56iMx7.js +32 -0
- playwright/driver/package/lib/vite/traceViewer/assets/defaultSettingsView-B34OrIms.js +181 -0
- playwright/driver/package/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- playwright/driver/package/lib/vite/traceViewer/assets/xtermModule-COQkjINf.js +7 -0
- playwright/driver/package/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- playwright/driver/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- playwright/driver/package/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
- playwright/driver/package/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- playwright/driver/package/lib/vite/traceViewer/index.Dl36UVQT.js +1 -0
- playwright/driver/package/lib/vite/traceViewer/index.html +44 -0
- playwright/driver/package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- playwright/driver/package/lib/vite/traceViewer/playwright-logo.svg +9 -0
- playwright/driver/package/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- playwright/driver/package/lib/vite/traceViewer/snapshot.html +10 -0
- playwright/driver/package/lib/vite/traceViewer/sw.bundle.js +4 -0
- playwright/driver/package/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
- playwright/driver/package/lib/vite/traceViewer/uiMode.D962mr9b.js +5 -0
- playwright/driver/package/lib/vite/traceViewer/uiMode.html +18 -0
- playwright/driver/package/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- playwright/driver/package/lib/webp_codec.LICENSE +173 -0
- playwright/driver/package/lib/webp_codec.wasm +0 -0
- playwright/driver/package/lib/xdg-open +1267 -0
- playwright/driver/package/package.json +34 -0
- playwright/driver/package/types/protocol.d.ts +24842 -0
- playwright/driver/package/types/structs.d.ts +47 -0
- playwright/driver/package/types/types.d.ts +26188 -0
- playwright/py.typed +0 -0
- playwright/sync_api/__init__.py +275 -0
- playwright/sync_api/_android_generated.py +494 -0
- playwright/sync_api/_context_manager.py +98 -0
- playwright/sync_api/_generated.py +24045 -0
- playwright_browserstack-1.62.0.dist-info/METADATA +82 -0
- playwright_browserstack-1.62.0.dist-info/RECORD +192 -0
- playwright_browserstack-1.62.0.dist-info/WHEEL +5 -0
- playwright_browserstack-1.62.0.dist-info/entry_points.txt +5 -0
- playwright_browserstack-1.62.0.dist-info/licenses/LICENSE +202 -0
- playwright_browserstack-1.62.0.dist-info/licenses/LICENSE.txt +51 -0
- playwright_browserstack-1.62.0.dist-info/licenses/NOTICE +18 -0
- playwright_browserstack-1.62.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions#escaping
|
|
16
|
+
escaped_chars = {"$", "^", "+", ".", "*", "(", ")", "|", "\\", "?", "{", "}", "[", "]"}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def glob_to_regex_pattern(glob: str) -> str:
|
|
20
|
+
tokens = ["^"]
|
|
21
|
+
in_group = False
|
|
22
|
+
|
|
23
|
+
i = 0
|
|
24
|
+
while i < len(glob):
|
|
25
|
+
c = glob[i]
|
|
26
|
+
if c == "\\" and i + 1 < len(glob):
|
|
27
|
+
char = glob[i + 1]
|
|
28
|
+
tokens.append("\\" + char if char in escaped_chars else char)
|
|
29
|
+
i += 1
|
|
30
|
+
elif c == "*":
|
|
31
|
+
char_before = glob[i - 1] if i > 0 else None
|
|
32
|
+
star_count = 1
|
|
33
|
+
while i + 1 < len(glob) and glob[i + 1] == "*":
|
|
34
|
+
star_count += 1
|
|
35
|
+
i += 1
|
|
36
|
+
if star_count > 1:
|
|
37
|
+
char_after = glob[i + 1] if i + 1 < len(glob) else None
|
|
38
|
+
if char_after == "/":
|
|
39
|
+
if char_before == "/":
|
|
40
|
+
tokens.append("((.+/)|)")
|
|
41
|
+
else:
|
|
42
|
+
tokens.append("(.*/)")
|
|
43
|
+
i += 1
|
|
44
|
+
else:
|
|
45
|
+
tokens.append("(.*)")
|
|
46
|
+
else:
|
|
47
|
+
tokens.append("([^/]*)")
|
|
48
|
+
else:
|
|
49
|
+
if c == "{":
|
|
50
|
+
in_group = True
|
|
51
|
+
tokens.append("(")
|
|
52
|
+
elif c == "}":
|
|
53
|
+
in_group = False
|
|
54
|
+
tokens.append(")")
|
|
55
|
+
elif c == ",":
|
|
56
|
+
if in_group:
|
|
57
|
+
tokens.append("|")
|
|
58
|
+
else:
|
|
59
|
+
tokens.append("\\" + c)
|
|
60
|
+
else:
|
|
61
|
+
tokens.append("\\" + c if c in escaped_chars else c)
|
|
62
|
+
i += 1
|
|
63
|
+
|
|
64
|
+
tokens.append("$")
|
|
65
|
+
return "".join(tokens)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
import os
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
|
|
17
|
+
import greenlet
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _greenlet_trace_callback(
|
|
21
|
+
event: str, args: Tuple[greenlet.greenlet, greenlet.greenlet]
|
|
22
|
+
) -> None:
|
|
23
|
+
if event in ("switch", "throw"):
|
|
24
|
+
origin, target = args
|
|
25
|
+
print(f"Transfer from {origin} to {target} with {event}")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if os.environ.get("INTERNAL_PW_GREENLET_DEBUG"):
|
|
29
|
+
greenlet.settrace(_greenlet_trace_callback)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MainGreenlet(greenlet.greenlet):
|
|
33
|
+
def __str__(self) -> str:
|
|
34
|
+
return "<MainGreenlet>"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class RouteGreenlet(greenlet.greenlet):
|
|
38
|
+
def __str__(self) -> str:
|
|
39
|
+
return "<RouteGreenlet>"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class LocatorHandlerGreenlet(greenlet.greenlet):
|
|
43
|
+
def __str__(self) -> str:
|
|
44
|
+
return "<LocatorHandlerGreenlet>"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class EventGreenlet(greenlet.greenlet):
|
|
48
|
+
def __str__(self) -> str:
|
|
49
|
+
return "<EventGreenlet>"
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
import asyncio
|
|
15
|
+
import base64
|
|
16
|
+
from typing import TYPE_CHECKING, Optional, cast
|
|
17
|
+
|
|
18
|
+
from playwright._impl._api_structures import HeadersArray
|
|
19
|
+
from playwright._impl._helper import (
|
|
20
|
+
HarLookupResult,
|
|
21
|
+
RouteFromHarNotFoundPolicy,
|
|
22
|
+
URLMatch,
|
|
23
|
+
)
|
|
24
|
+
from playwright._impl._local_utils import LocalUtils
|
|
25
|
+
|
|
26
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
27
|
+
from playwright._impl._browser_context import BrowserContext
|
|
28
|
+
from playwright._impl._network import Route
|
|
29
|
+
from playwright._impl._page import Page
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class HarRouter:
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
local_utils: LocalUtils,
|
|
36
|
+
har_id: str,
|
|
37
|
+
not_found_action: RouteFromHarNotFoundPolicy,
|
|
38
|
+
url_matcher: Optional[URLMatch] = None,
|
|
39
|
+
) -> None:
|
|
40
|
+
self._local_utils: LocalUtils = local_utils
|
|
41
|
+
self._har_id: str = har_id
|
|
42
|
+
self._not_found_action: RouteFromHarNotFoundPolicy = not_found_action
|
|
43
|
+
self._options_url_match: Optional[URLMatch] = url_matcher
|
|
44
|
+
|
|
45
|
+
@staticmethod
|
|
46
|
+
async def create(
|
|
47
|
+
local_utils: LocalUtils,
|
|
48
|
+
file: str,
|
|
49
|
+
not_found_action: RouteFromHarNotFoundPolicy,
|
|
50
|
+
url_matcher: Optional[URLMatch] = None,
|
|
51
|
+
) -> "HarRouter":
|
|
52
|
+
har_id = await local_utils._channel.send("harOpen", None, {"file": file})
|
|
53
|
+
return HarRouter(
|
|
54
|
+
local_utils=local_utils,
|
|
55
|
+
har_id=har_id,
|
|
56
|
+
not_found_action=not_found_action,
|
|
57
|
+
url_matcher=url_matcher,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
async def _handle(self, route: "Route") -> None:
|
|
61
|
+
request = route.request
|
|
62
|
+
response: HarLookupResult = await self._local_utils.har_lookup(
|
|
63
|
+
harId=self._har_id,
|
|
64
|
+
url=request.url,
|
|
65
|
+
method=request.method,
|
|
66
|
+
headers=await request.headers_array(),
|
|
67
|
+
postData=request.post_data_buffer,
|
|
68
|
+
isNavigationRequest=request.is_navigation_request(),
|
|
69
|
+
)
|
|
70
|
+
action = response["action"]
|
|
71
|
+
if action == "redirect":
|
|
72
|
+
redirect_url = response["redirectURL"]
|
|
73
|
+
assert redirect_url
|
|
74
|
+
await route._redirected_navigation_request(redirect_url)
|
|
75
|
+
return
|
|
76
|
+
|
|
77
|
+
if action == "fulfill":
|
|
78
|
+
# If the response status is -1, the request was canceled or stalled, so we just stall it here.
|
|
79
|
+
# See https://github.com/microsoft/playwright/issues/29311.
|
|
80
|
+
# TODO: it'd be better to abort such requests, but then we likely need to respect the timing,
|
|
81
|
+
# because the request might have been stalled for a long time until the very end of the
|
|
82
|
+
# test when HAR was recorded but we'd abort it immediately.
|
|
83
|
+
if response.get("status") == -1:
|
|
84
|
+
return
|
|
85
|
+
body = response["body"]
|
|
86
|
+
assert body is not None
|
|
87
|
+
await route.fulfill(
|
|
88
|
+
status=response.get("status"),
|
|
89
|
+
headers={
|
|
90
|
+
v["name"]: v["value"]
|
|
91
|
+
for v in cast(HeadersArray, response.get("headers", []))
|
|
92
|
+
},
|
|
93
|
+
body=base64.b64decode(body),
|
|
94
|
+
)
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
if action == "error":
|
|
98
|
+
pass
|
|
99
|
+
# Report the error, but fall through to the default handler.
|
|
100
|
+
|
|
101
|
+
if self._not_found_action == "abort":
|
|
102
|
+
await route.abort()
|
|
103
|
+
return
|
|
104
|
+
|
|
105
|
+
await route.fallback()
|
|
106
|
+
|
|
107
|
+
async def add_context_route(self, context: "BrowserContext") -> None:
|
|
108
|
+
await context.route(
|
|
109
|
+
url=self._options_url_match or "**/*",
|
|
110
|
+
handler=lambda route, _: asyncio.create_task(self._handle(route)),
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
async def add_page_route(self, page: "Page") -> None:
|
|
114
|
+
await page.route(
|
|
115
|
+
url=self._options_url_match or "**/*",
|
|
116
|
+
handler=lambda route, _: asyncio.create_task(self._handle(route)),
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
def dispose(self) -> None:
|
|
120
|
+
self._local_utils._channel.send_may_fail(
|
|
121
|
+
"harClose", None, {"harId": self._har_id}
|
|
122
|
+
)
|