playwright-browserstack 1.62.0__py3-none-win_amd64.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,98 @@
|
|
|
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
|
+
from asyncio import AbstractEventLoop
|
|
16
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union
|
|
17
|
+
|
|
18
|
+
from playwright._impl._api_structures import SourceLocation
|
|
19
|
+
from playwright._impl._connection import from_channel, from_nullable_channel
|
|
20
|
+
from playwright._impl._js_handle import JSHandle
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
23
|
+
from playwright._impl._page import Page
|
|
24
|
+
from playwright._impl._worker import Worker
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ConsoleMessage:
|
|
28
|
+
def __init__(
|
|
29
|
+
self, event: Dict, loop: AbstractEventLoop, dispatcher_fiber: Any
|
|
30
|
+
) -> None:
|
|
31
|
+
self._event = event
|
|
32
|
+
self._loop = loop
|
|
33
|
+
self._dispatcher_fiber = dispatcher_fiber
|
|
34
|
+
self._page: Optional["Page"] = from_nullable_channel(event.get("page"))
|
|
35
|
+
self._worker: Optional["Worker"] = from_nullable_channel(event.get("worker"))
|
|
36
|
+
|
|
37
|
+
def __repr__(self) -> str:
|
|
38
|
+
return f"<ConsoleMessage type={self.type} text={self.text}>"
|
|
39
|
+
|
|
40
|
+
def __str__(self) -> str:
|
|
41
|
+
return self.text
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def type(self) -> Union[
|
|
45
|
+
Literal["assert"],
|
|
46
|
+
Literal["clear"],
|
|
47
|
+
Literal["count"],
|
|
48
|
+
Literal["debug"],
|
|
49
|
+
Literal["dir"],
|
|
50
|
+
Literal["dirxml"],
|
|
51
|
+
Literal["endGroup"],
|
|
52
|
+
Literal["error"],
|
|
53
|
+
Literal["info"],
|
|
54
|
+
Literal["log"],
|
|
55
|
+
Literal["profile"],
|
|
56
|
+
Literal["profileEnd"],
|
|
57
|
+
Literal["startGroup"],
|
|
58
|
+
Literal["startGroupCollapsed"],
|
|
59
|
+
Literal["table"],
|
|
60
|
+
Literal["time"],
|
|
61
|
+
Literal["timeEnd"],
|
|
62
|
+
Literal["trace"],
|
|
63
|
+
Literal["warning"],
|
|
64
|
+
]:
|
|
65
|
+
return self._event["type"]
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def text(self) -> str:
|
|
69
|
+
return self._event["text"]
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def args(self) -> List[JSHandle]:
|
|
73
|
+
return list(map(from_channel, self._event["args"]))
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def location(self) -> SourceLocation:
|
|
77
|
+
# Wire format uses `lineNumber`/`columnNumber`; docs expose both `line`/`column`
|
|
78
|
+
# (legacy) and `lineNumber`/`columnNumber` (added upstream in 1.60).
|
|
79
|
+
loc = self._event["location"]
|
|
80
|
+
return {
|
|
81
|
+
"url": loc["url"],
|
|
82
|
+
"line": loc["lineNumber"],
|
|
83
|
+
"column": loc["columnNumber"],
|
|
84
|
+
"lineNumber": loc["lineNumber"],
|
|
85
|
+
"columnNumber": loc["columnNumber"],
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def timestamp(self) -> float:
|
|
90
|
+
return self._event["timestamp"]
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def page(self) -> Optional["Page"]:
|
|
94
|
+
return self._page
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def worker(self) -> Optional["Worker"]:
|
|
98
|
+
return self._worker
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
from typing import TYPE_CHECKING, List
|
|
16
|
+
|
|
17
|
+
from playwright._impl._api_structures import VirtualCredential
|
|
18
|
+
from playwright._impl._helper import locals_to_params
|
|
19
|
+
|
|
20
|
+
if TYPE_CHECKING:
|
|
21
|
+
from playwright._impl._browser_context import BrowserContext
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Credentials:
|
|
25
|
+
def __init__(self, browser_context: "BrowserContext") -> None:
|
|
26
|
+
self._browser_context = browser_context
|
|
27
|
+
self._loop = browser_context._loop
|
|
28
|
+
self._dispatcher_fiber = browser_context._dispatcher_fiber
|
|
29
|
+
|
|
30
|
+
async def install(self) -> None:
|
|
31
|
+
await self._browser_context._channel.send("credentialsInstall", None)
|
|
32
|
+
|
|
33
|
+
async def create(
|
|
34
|
+
self,
|
|
35
|
+
rpId: str,
|
|
36
|
+
id: str = None,
|
|
37
|
+
userHandle: str = None,
|
|
38
|
+
privateKey: str = None,
|
|
39
|
+
publicKey: str = None,
|
|
40
|
+
) -> VirtualCredential:
|
|
41
|
+
result = await self._browser_context._channel.send_return_as_dict(
|
|
42
|
+
"credentialsCreate", None, locals_to_params(locals())
|
|
43
|
+
)
|
|
44
|
+
return (result or {})["credential"]
|
|
45
|
+
|
|
46
|
+
async def delete(self, id: str) -> None:
|
|
47
|
+
await self._browser_context._channel.send("credentialsDelete", None, {"id": id})
|
|
48
|
+
|
|
49
|
+
async def get(
|
|
50
|
+
self,
|
|
51
|
+
rpId: str = None,
|
|
52
|
+
id: str = None,
|
|
53
|
+
) -> List[VirtualCredential]:
|
|
54
|
+
result = await self._browser_context._channel.send_return_as_dict(
|
|
55
|
+
"credentialsGet", None, locals_to_params(locals())
|
|
56
|
+
)
|
|
57
|
+
return (result or {}).get("credentials", [])
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
from types import SimpleNamespace
|
|
16
|
+
from typing import Any, Dict, Optional
|
|
17
|
+
|
|
18
|
+
from playwright._impl._api_structures import DebuggerLocation, DebuggerPausedDetails
|
|
19
|
+
from playwright._impl._connection import ChannelOwner
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Debugger(ChannelOwner):
|
|
23
|
+
Events = SimpleNamespace(
|
|
24
|
+
PausedStateChanged="pausedstatechanged",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
|
|
29
|
+
) -> None:
|
|
30
|
+
super().__init__(parent, type, guid, initializer)
|
|
31
|
+
self._paused_details: Optional[DebuggerPausedDetails] = None
|
|
32
|
+
self._channel.on(
|
|
33
|
+
"pausedStateChanged", lambda params: self._on_paused_state_changed(params)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def _on_paused_state_changed(self, params: Dict[str, Any]) -> None:
|
|
37
|
+
self._paused_details = params.get("pausedDetails")
|
|
38
|
+
self.emit(Debugger.Events.PausedStateChanged)
|
|
39
|
+
|
|
40
|
+
async def request_pause(self) -> None:
|
|
41
|
+
await self._channel.send("requestPause", None)
|
|
42
|
+
|
|
43
|
+
async def resume(self) -> None:
|
|
44
|
+
await self._channel.send("resume", None)
|
|
45
|
+
|
|
46
|
+
async def next(self) -> None:
|
|
47
|
+
await self._channel.send("next", None)
|
|
48
|
+
|
|
49
|
+
async def run_to(self, location: DebuggerLocation) -> None:
|
|
50
|
+
await self._channel.send("runTo", None, {"location": location})
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def paused_details(self) -> Optional[DebuggerPausedDetails]:
|
|
54
|
+
return self._paused_details
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
from typing import TYPE_CHECKING, Dict, Optional
|
|
16
|
+
|
|
17
|
+
from playwright._impl._connection import ChannelOwner, from_nullable_channel
|
|
18
|
+
from playwright._impl._errors import is_target_closed_error
|
|
19
|
+
from playwright._impl._helper import locals_to_params
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
22
|
+
from playwright._impl._page import Page
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Dialog(ChannelOwner):
|
|
26
|
+
def __init__(
|
|
27
|
+
self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
|
|
28
|
+
) -> None:
|
|
29
|
+
super().__init__(parent, type, guid, initializer)
|
|
30
|
+
self._page: Optional["Page"] = from_nullable_channel(initializer.get("page"))
|
|
31
|
+
|
|
32
|
+
def __repr__(self) -> str:
|
|
33
|
+
return f"<Dialog type={self.type} message={self.message} default_value={self.default_value}>"
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def type(self) -> str:
|
|
37
|
+
return self._initializer["type"]
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def message(self) -> str:
|
|
41
|
+
return self._initializer["message"]
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def default_value(self) -> str:
|
|
45
|
+
return self._initializer["defaultValue"]
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def page(self) -> Optional["Page"]:
|
|
49
|
+
return self._page
|
|
50
|
+
|
|
51
|
+
async def accept(self, promptText: str = None) -> None:
|
|
52
|
+
await self._channel.send("accept", None, locals_to_params(locals()))
|
|
53
|
+
|
|
54
|
+
async def dismiss(self) -> None:
|
|
55
|
+
try:
|
|
56
|
+
await self._channel.send(
|
|
57
|
+
"dismiss",
|
|
58
|
+
None,
|
|
59
|
+
)
|
|
60
|
+
except Exception as e:
|
|
61
|
+
if is_target_closed_error(e):
|
|
62
|
+
return
|
|
63
|
+
raise
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
import asyncio
|
|
16
|
+
import traceback
|
|
17
|
+
from typing import Awaitable, Callable, Dict
|
|
18
|
+
|
|
19
|
+
import greenlet
|
|
20
|
+
|
|
21
|
+
from playwright._impl._connection import ChannelOwner, _capture_stack_trace
|
|
22
|
+
from playwright._impl._errors import Error, is_target_closed_error
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Disposable(ChannelOwner):
|
|
26
|
+
def __init__(
|
|
27
|
+
self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
|
|
28
|
+
) -> None:
|
|
29
|
+
super().__init__(parent, type, guid, initializer)
|
|
30
|
+
|
|
31
|
+
async def dispose(self) -> None:
|
|
32
|
+
try:
|
|
33
|
+
await self._channel.send(
|
|
34
|
+
"dispose",
|
|
35
|
+
None,
|
|
36
|
+
)
|
|
37
|
+
except Exception as e:
|
|
38
|
+
if not is_target_closed_error(e):
|
|
39
|
+
raise e
|
|
40
|
+
|
|
41
|
+
async def close(self) -> None:
|
|
42
|
+
await self.dispose()
|
|
43
|
+
|
|
44
|
+
def __repr__(self) -> str:
|
|
45
|
+
return "<Disposable>"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class DisposableStub:
|
|
49
|
+
def __init__(
|
|
50
|
+
self,
|
|
51
|
+
dispose_fn: Callable[[], Awaitable[None]],
|
|
52
|
+
parent: ChannelOwner,
|
|
53
|
+
) -> None:
|
|
54
|
+
self._dispose_fn = dispose_fn
|
|
55
|
+
self._loop = parent._loop
|
|
56
|
+
self._dispatcher_fiber = parent._dispatcher_fiber
|
|
57
|
+
|
|
58
|
+
async def dispose(self) -> None:
|
|
59
|
+
await self._dispose_fn()
|
|
60
|
+
|
|
61
|
+
async def __aenter__(self) -> "DisposableStub":
|
|
62
|
+
return self
|
|
63
|
+
|
|
64
|
+
async def __aexit__(self, *args: object) -> None:
|
|
65
|
+
await self.dispose()
|
|
66
|
+
|
|
67
|
+
def __enter__(self) -> "DisposableStub":
|
|
68
|
+
return self
|
|
69
|
+
|
|
70
|
+
def __exit__(self, *args: object) -> None:
|
|
71
|
+
self._sync(self.dispose())
|
|
72
|
+
|
|
73
|
+
def _sync(self, coro: object) -> object:
|
|
74
|
+
__tracebackhide__ = True
|
|
75
|
+
if self._loop.is_closed():
|
|
76
|
+
coro.close() # type: ignore
|
|
77
|
+
raise Error("Event loop is closed! Is Playwright already stopped?")
|
|
78
|
+
g_self = greenlet.getcurrent()
|
|
79
|
+
task = self._loop.create_task(coro) # type: ignore
|
|
80
|
+
setattr(
|
|
81
|
+
task,
|
|
82
|
+
"__pw_stack__",
|
|
83
|
+
_capture_stack_trace(),
|
|
84
|
+
)
|
|
85
|
+
setattr(task, "__pw_stack_trace__", traceback.extract_stack(limit=10))
|
|
86
|
+
task.add_done_callback(lambda _: g_self.switch())
|
|
87
|
+
while not task.done():
|
|
88
|
+
self._dispatcher_fiber.switch() # type: ignore
|
|
89
|
+
asyncio._set_running_loop(self._loop)
|
|
90
|
+
return task.result()
|
|
91
|
+
|
|
92
|
+
async def close(self) -> None:
|
|
93
|
+
await self.dispose()
|
|
94
|
+
|
|
95
|
+
def __repr__(self) -> str:
|
|
96
|
+
return "<Disposable>"
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
import pathlib
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import TYPE_CHECKING, Optional, Union
|
|
18
|
+
|
|
19
|
+
from playwright._impl._artifact import Artifact
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
22
|
+
from playwright._impl._page import Page
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Download:
|
|
26
|
+
def __init__(
|
|
27
|
+
self, page: "Page", url: str, suggested_filename: str, artifact: Artifact
|
|
28
|
+
) -> None:
|
|
29
|
+
self._page = page
|
|
30
|
+
self._loop = page._loop
|
|
31
|
+
self._dispatcher_fiber = page._dispatcher_fiber
|
|
32
|
+
self._url = url
|
|
33
|
+
self._suggested_filename = suggested_filename
|
|
34
|
+
self._artifact = artifact
|
|
35
|
+
|
|
36
|
+
def __repr__(self) -> str:
|
|
37
|
+
return f"<Download url={self.url!r} suggested_filename={self.suggested_filename!r}>"
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def page(self) -> "Page":
|
|
41
|
+
return self._page
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def url(self) -> str:
|
|
45
|
+
return self._url
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def suggested_filename(self) -> str:
|
|
49
|
+
return self._suggested_filename
|
|
50
|
+
|
|
51
|
+
async def delete(self) -> None:
|
|
52
|
+
await self._artifact.delete()
|
|
53
|
+
|
|
54
|
+
async def failure(self) -> Optional[str]:
|
|
55
|
+
return await self._artifact.failure()
|
|
56
|
+
|
|
57
|
+
async def path(self) -> pathlib.Path:
|
|
58
|
+
return await self._artifact.path_after_finished()
|
|
59
|
+
|
|
60
|
+
async def save_as(self, path: Union[str, Path]) -> None:
|
|
61
|
+
await self._artifact.save_as(path)
|
|
62
|
+
|
|
63
|
+
async def cancel(self) -> None:
|
|
64
|
+
return await self._artifact.cancel()
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
import inspect
|
|
16
|
+
import os
|
|
17
|
+
import sys
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import Tuple
|
|
20
|
+
|
|
21
|
+
import playwright
|
|
22
|
+
from playwright._repo_version import version
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def compute_driver_executable() -> Tuple[str, str]:
|
|
26
|
+
driver_path = Path(inspect.getfile(playwright)).parent / "driver"
|
|
27
|
+
cli_path = str(driver_path / "package" / "cli.js")
|
|
28
|
+
if sys.platform == "win32":
|
|
29
|
+
return (
|
|
30
|
+
os.getenv("PLAYWRIGHT_NODEJS_PATH", str(driver_path / "node.exe")),
|
|
31
|
+
cli_path,
|
|
32
|
+
)
|
|
33
|
+
return (os.getenv("PLAYWRIGHT_NODEJS_PATH", str(driver_path / "node")), cli_path)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_driver_env() -> dict:
|
|
37
|
+
env = os.environ.copy()
|
|
38
|
+
env["PW_LANG_NAME"] = "python"
|
|
39
|
+
env["PW_LANG_NAME_VERSION"] = f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
40
|
+
env["PW_CLI_DISPLAY_VERSION"] = version
|
|
41
|
+
return env
|