browser-tools 0.4.1__tar.gz → 0.6.0__tar.gz
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.
- {browser_tools-0.4.1 → browser_tools-0.6.0}/PKG-INFO +3 -2
- {browser_tools-0.4.1 → browser_tools-0.6.0}/pyproject.toml +3 -2
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/GUIDE.txt +126 -1
- browser_tools-0.6.0/src/browser_tools/attached_session.py +135 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/cdp_client.py +0 -7
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/cdp_handler.py +387 -43
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/cli.py +421 -218
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/cdp_client.py +24 -1
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/curated.py +208 -68
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/events.py +41 -21
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/frame_manager.py +214 -11
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/list_verbs.py +29 -17
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/one_shot.py +78 -1
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/passthrough.py +19 -3
- browser_tools-0.6.0/src/browser_tools/step_list.py +400 -0
- browser_tools-0.6.0/src/browser_tools/step_run.py +264 -0
- browser_tools-0.6.0/tests/doubles.py +147 -0
- browser_tools-0.6.0/tests/parity/test_camoufox_live_launch.py +160 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_e2e_camoufox.py +14 -4
- browser_tools-0.6.0/tests/test_attached_session.py +243 -0
- browser_tools-0.6.0/tests/test_core_send_timeout.py +216 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_curated_verbs.py +39 -2
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_guide.py +87 -0
- browser_tools-0.6.0/tests/test_handler_transport.py +221 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_interaction_targeting.py +6 -2
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_list_verbs.py +4 -1
- browser_tools-0.6.0/tests/test_session_hygiene.py +1052 -0
- browser_tools-0.6.0/tests/test_shared_session.py +415 -0
- browser_tools-0.6.0/tests/test_step_dispatch.py +177 -0
- browser_tools-0.6.0/tests/test_step_list.py +525 -0
- browser_tools-0.6.0/tests/test_step_run.py +1230 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/.gitignore +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/LICENSE +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/NOTICE +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/README.md +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/__init__.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/camoufox_runner.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/cdp_constants.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/__init__.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/attach.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/connection.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/__init__.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/accessibility.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/animation.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/audits.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/autofill.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/background_service.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/bluetooth_emulation.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/browser.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/cache_storage.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/cast.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/console.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/css.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/debugger.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/device_access.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/device_orientation.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/dom.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/dom_debugger.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/dom_snapshot.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/dom_storage.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/emulation.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/event_breakpoints.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/extensions.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/fed_cm.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/fetch.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/file_system.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/headless_experimental.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/heap_profiler.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/indexed_db.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/input.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/inspector.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/io.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/layer_tree.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/log.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/media.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/memory.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/network.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/overlay.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/page.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/performance.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/performance_timeline.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/preload.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/profiler.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/pwa.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/runtime.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/schema.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/security.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/service_worker.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/smart_card_emulation.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/storage.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/system_info.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/target.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/tethering.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/tracing.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/web_audio.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/domains/web_authn.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/errors.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/fingerprint.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/instance_status.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/launcher.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/protocol.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/registry.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/supervisor.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/core/utils.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/detect_interstitial.js +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/endpoint.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/extras.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/interstitial.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/lifecycle.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/mcp_response.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/native_interaction.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/native_snapshot.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/process_utils.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/profiler.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/screencast.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/screenshot_utils.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/tool_registry.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/usage.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/src/browser_tools/user_settings.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/conftest.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/CORPUS.md +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/camoufox_session.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/conftest.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/fixtures/dynamic.html +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/fixtures/form.html +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/fixtures/iframe.html +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/fixtures/iframe_child.html +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/fixtures/plain.html +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/fixtures/shadow.html +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/live_chromium.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/node_broker.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/parity_comparison.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/parity_corpus.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/parity_engines.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/run_baseline.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_camoufox_session.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_node_broker.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_parity_baseline.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_parity_corpus.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_parity_engine.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_parity_gate.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_parity_native.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_parity_native_interaction.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/parity/test_parity_operator.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_async_discovery.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_cdp_client.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_cli_grammar.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_cli_lifecycle.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_cli_surface.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_core_launcher.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_detached_tasks.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_diagnostics_name_real_verbs.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_endpoint.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_events.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_frame_manager.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_interstitial.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_native_backend.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_native_interaction.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_native_snapshot.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_new_tools.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_one_shot.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_packaging.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_passthrough.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_profile_liveness.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_profile_path_hardening.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_profile_root_move.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_profile_verbs.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_profiler.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_retained_contracts.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_stop_target.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_supervisor_document_liveness.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_supervisor_never_pauses.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_supervisor_profile_preservation.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_supervisor_visibility.py +0 -0
- {browser_tools-0.4.1 → browser_tools-0.6.0}/tests/test_window_marking.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: browser-tools
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Browser automation, debugging, and anti-detect browsing CLI
|
|
5
5
|
Project-URL: Homepage, https://github.com/dungle-scrubs/browser-tools
|
|
6
6
|
Project-URL: Repository, https://github.com/dungle-scrubs/browser-tools
|
|
7
7
|
Project-URL: Issues, https://github.com/dungle-scrubs/browser-tools/issues
|
|
8
|
-
Project-URL: Changelog, https://github.com/dungle-scrubs/browser-tools/
|
|
8
|
+
Project-URL: Changelog, https://github.com/dungle-scrubs/browser-tools/releases
|
|
9
9
|
License-Expression: MIT
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
License-File: NOTICE
|
|
@@ -19,6 +19,7 @@ Classifier: Operating System :: POSIX :: Linux
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3
|
|
20
20
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
23
|
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
|
|
23
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
25
|
Classifier: Topic :: Software Development :: Testing
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "browser-tools"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
4
4
|
description = "Browser automation, debugging, and anti-detect browsing CLI"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -23,6 +23,7 @@ classifiers = [
|
|
|
23
23
|
"Operating System :: POSIX :: Linux",
|
|
24
24
|
"Programming Language :: Python :: 3",
|
|
25
25
|
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
26
27
|
"Programming Language :: Python :: 3 :: Only",
|
|
27
28
|
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
|
28
29
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
@@ -65,7 +66,7 @@ all = [
|
|
|
65
66
|
Homepage = "https://github.com/dungle-scrubs/browser-tools"
|
|
66
67
|
Repository = "https://github.com/dungle-scrubs/browser-tools"
|
|
67
68
|
Issues = "https://github.com/dungle-scrubs/browser-tools/issues"
|
|
68
|
-
Changelog = "https://github.com/dungle-scrubs/browser-tools/
|
|
69
|
+
Changelog = "https://github.com/dungle-scrubs/browser-tools/releases"
|
|
69
70
|
|
|
70
71
|
[project.scripts]
|
|
71
72
|
browser-tools = "browser_tools.cli:main"
|
|
@@ -6,6 +6,10 @@ tool; nothing else needs to be read first. `bt guide` prints it.
|
|
|
6
6
|
The install also puts down `browser-tools-profiler`, a separate command for
|
|
7
7
|
CPU profiling. It is the last section here.
|
|
8
8
|
|
|
9
|
+
`bt --version` prints the installed version. Check it first when behaviour
|
|
10
|
+
does not match this manual: an older copy earlier on PATH answers the same
|
|
11
|
+
verbs and answers them differently.
|
|
12
|
+
|
|
9
13
|
The tool tracks named browser instances in a registry. Each instance is one
|
|
10
14
|
running browser process, named after the directory it was launched from.
|
|
11
15
|
Liveness is engine-aware: Chrome is process identity plus CDP port
|
|
@@ -175,6 +179,126 @@ CURATED VERBS
|
|
|
175
179
|
frames.
|
|
176
180
|
|
|
177
181
|
|
|
182
|
+
RUNNING MANY STEPS IN ONE INVOCATION
|
|
183
|
+
|
|
184
|
+
run FILE [--timeout SECONDS]
|
|
185
|
+
run - [--timeout SECONDS]
|
|
186
|
+
Run an ordered list of steps against one browser, in one invocation, over
|
|
187
|
+
one CDP connection. FILE is the list; `-` reads it from stdin. Takes
|
|
188
|
+
[INSTANCE] and --endpoint URL as above, and --target SPEC or --url
|
|
189
|
+
SUBSTRING to pick the page the whole run drives.
|
|
190
|
+
|
|
191
|
+
One step per line, each line a verb phrase exactly as you would type it
|
|
192
|
+
after the instance name. Blank lines and lines starting with # are
|
|
193
|
+
ignored; a # anywhere else is an ordinary character, so a URL fragment
|
|
194
|
+
or a --text value carrying one needs no quoting for that reason. Lines
|
|
195
|
+
are split the way a shell splits them, so quoting works as it does at
|
|
196
|
+
the prompt.
|
|
197
|
+
|
|
198
|
+
# select the checkout frame once, then read it twice
|
|
199
|
+
frames select checkout
|
|
200
|
+
storage get
|
|
201
|
+
Page.getNavigationHistory '{}'
|
|
202
|
+
snapshot
|
|
203
|
+
|
|
204
|
+
This is not a scripting language. There are no variables, no conditions,
|
|
205
|
+
no loops, and no way for one step to use another step's output. A run does
|
|
206
|
+
what the same commands would do one after another; it cannot decide
|
|
207
|
+
anything. Where you need a decision, read the output and run again.
|
|
208
|
+
|
|
209
|
+
A STEP IS A VERB, NOT AN INVOCATION. Steps may be: snapshot, click, fill,
|
|
210
|
+
wait-idle, wait-stable, wait, detect, console-list, network-list, frames,
|
|
211
|
+
storage get, screenshot, screencast, and any raw Domain.method. A step may
|
|
212
|
+
NOT name an instance, --endpoint, --target or --url: those belong to the
|
|
213
|
+
run, which resolves them once. attach is not a step (it runs until stdin
|
|
214
|
+
ends, so nothing could follow it), and neither are launch, status, stop,
|
|
215
|
+
cleanup, profile, window-border, guide, help or run itself. Any of these
|
|
216
|
+
in a step list is a usage error (exit 2).
|
|
217
|
+
|
|
218
|
+
FRAME SELECTION LASTS. `frames select` in one step governs the steps after
|
|
219
|
+
it, so `storage get` with no --key works inside a run. A selection
|
|
220
|
+
remembers the pattern you gave it, so after a navigation it re-points at
|
|
221
|
+
whatever frame now matches. If nothing matches any more, the selection is
|
|
222
|
+
cleared and the next frame-scoped step fails rather than reading the wrong
|
|
223
|
+
frame. The selected frame going away clears it too, but the pattern is
|
|
224
|
+
kept either way, so a later navigation that brings a matching frame back
|
|
225
|
+
selects it again. Only `frames reset` and a new `frames select` change the
|
|
226
|
+
pattern. `storage get --key` does not: the key names the frame for that
|
|
227
|
+
one read, and the selection is put back afterwards.
|
|
228
|
+
|
|
229
|
+
AFTER A NAVIGATION, WAIT BEFORE YOU READ. Page.navigate returns when the
|
|
230
|
+
navigation commits, and the frame tree updates from the event that
|
|
231
|
+
follows it. A step placed straight after a navigate can run before that
|
|
232
|
+
event arrives and see the frames of the page you just left. Put a
|
|
233
|
+
`wait-idle` step in between.
|
|
234
|
+
|
|
235
|
+
Use `wait-idle` and not `wait --event Page.loadEventFired` here. `wait`
|
|
236
|
+
reports events that arrive after it subscribes, and it subscribes when
|
|
237
|
+
its own step starts. A load that fired in the gap after the navigate step
|
|
238
|
+
is already gone, and the wait then times out on a page that has finished
|
|
239
|
+
loading. `wait-idle` reads the page's current state instead of waiting
|
|
240
|
+
for an edge, so it cannot miss one. It answers a narrower question than
|
|
241
|
+
`load` - the new document has stopped fetching - which is the question
|
|
242
|
+
this paragraph is about.
|
|
243
|
+
|
|
244
|
+
EVERYTHING ELSE BEHAVES AS IT WOULD ALONE, WITH ONE EXCEPTION. A step
|
|
245
|
+
inside a run does what the same command does on its own. Domains a step
|
|
246
|
+
turns on are turned off when that step ends, so a second `network-list`
|
|
247
|
+
in one run sees what the first one saw.
|
|
248
|
+
|
|
249
|
+
The exception is the Page and Runtime domains. A run needs them on
|
|
250
|
+
throughout to track frames, so they are never turned off between steps.
|
|
251
|
+
A step that relies on being the first to turn one of them on does not
|
|
252
|
+
get that. `wait --event Runtime.executionContextCreated` after any step
|
|
253
|
+
that touched Runtime reports nothing, where the same command on its own
|
|
254
|
+
reports the contexts that already exist; `console-list` is in the same
|
|
255
|
+
position, because it turns Runtime on too. Run either one on its own.
|
|
256
|
+
|
|
257
|
+
A raw step you write yourself is yours to undo. `Network.enable {}`
|
|
258
|
+
stays on until a later step turns it off; the rule above covers only the
|
|
259
|
+
domains a verb turns on for you. It wins over that rule where the two
|
|
260
|
+
meet: a `network-list` step after a hand-written `Network.enable` leaves
|
|
261
|
+
the domain on, because turning it off would make your step a no-op. The
|
|
262
|
+
price is that the `network-list` is not the first enable, the same
|
|
263
|
+
position Page and Runtime are already in.
|
|
264
|
+
|
|
265
|
+
The two exceptions are the run's own: `Page.disable` and
|
|
266
|
+
`Runtime.disable` are usage errors as steps (exit 2), because turning
|
|
267
|
+
either off breaks every step after it without failing any of them. Run
|
|
268
|
+
either on its own, outside a run.
|
|
269
|
+
|
|
270
|
+
UIDS ARE UNCHANGED. A UID is still valid until the page navigates, no
|
|
271
|
+
longer and no shorter. One process does not extend it. Because no step can
|
|
272
|
+
read another step's output, every UID in a step list is one you put there
|
|
273
|
+
from a snapshot you already read.
|
|
274
|
+
|
|
275
|
+
IT STOPS AT THE FIRST FAILURE, and nothing rolls back. A step that has run
|
|
276
|
+
has already reached the browser. Steps after the failure do not run.
|
|
277
|
+
|
|
278
|
+
--timeout SECONDS bounds the whole run; without it there is no whole-run
|
|
279
|
+
deadline, because every step already bounds itself. Use it when a step
|
|
280
|
+
opts out of its own bound, as `wait --timeout 0` does.
|
|
281
|
+
|
|
282
|
+
OUTPUT. One JSON document, on success and on failure alike: a `run` object
|
|
283
|
+
with the step count, how many completed, and the status; and a `steps`
|
|
284
|
+
array with one entry per step attempted, each carrying the JSON that step
|
|
285
|
+
would have printed alone. Steps never reached are absent.
|
|
286
|
+
|
|
287
|
+
READ IT IN THIS ORDER: the exit code, then `run.status`, then the steps.
|
|
288
|
+
A failed run still contains successful step entries, and each of those
|
|
289
|
+
carries exactly what that step prints on its own. If you parse the steps
|
|
290
|
+
without checking the exit code first, a run that died at step 7 reads
|
|
291
|
+
like a run that finished.
|
|
292
|
+
|
|
293
|
+
Exit 0 every step succeeded.
|
|
294
|
+
Exit 1 a step failed, or the run timed out. The document is still
|
|
295
|
+
printed, so you can see what already ran. This is the one verb
|
|
296
|
+
that prints on stdout when it exits 1.
|
|
297
|
+
Exit 2 the step list was malformed, or a step named an instance,
|
|
298
|
+
--endpoint, --target or --url. The whole list is checked before
|
|
299
|
+
the first step runs, so nothing ran.
|
|
300
|
+
|
|
301
|
+
|
|
178
302
|
EVENT VERBS
|
|
179
303
|
|
|
180
304
|
attach [INSTANCE] +Domain.event [+Domain.event ...]
|
|
@@ -500,6 +624,7 @@ OUTPUT AND EXIT CODES
|
|
|
500
624
|
Exit 0 success.
|
|
501
625
|
Exit 1 operational failure: the browser is gone, a CDP call failed, a
|
|
502
626
|
deadline passed, a profile is held, a UID no longer resolves.
|
|
503
|
-
Nothing is printed on stdout
|
|
627
|
+
Nothing is printed on stdout, except by `run`, which prints its
|
|
628
|
+
run document so you can see which steps already ran.
|
|
504
629
|
Exit 2 usage error: the invocation was malformed or refused before
|
|
505
630
|
anything happened. Nothing was sent, written or deleted.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""The handler's client, backed by an attached Target session.
|
|
2
|
+
|
|
3
|
+
RFC-03 requires the run's **CDPRuntime**, and therefore its frame manager, to
|
|
4
|
+
sit on one flattened ``Target`` session of one browser-level CDP connection.
|
|
5
|
+
``AttachedSessionClient`` is what puts it there: it presents
|
|
6
|
+
``cdp_client.CDPClient``'s surface over ``core.cdp_client.CDPClient``, so what
|
|
7
|
+
a caller sends is unchanged and where it is sent changes.
|
|
8
|
+
|
|
9
|
+
Three properties the callers depend on, none of which the core client gives
|
|
10
|
+
on its own:
|
|
11
|
+
|
|
12
|
+
- **Session scope.** Every send carries the session, and every subscription
|
|
13
|
+
filters on it. A browser-level connection sees every attached target's
|
|
14
|
+
events; ``core/cdp_client.py`` delivers one only when the subscriber's
|
|
15
|
+
filter session matches.
|
|
16
|
+
- **A bounded command.** The core client defaults to no deadline. ``send``
|
|
17
|
+
asks it for 30 seconds, the bound the page-level client always applied. The
|
|
18
|
+
bound is passed down, not wrapped around the call: only the core ``send``
|
|
19
|
+
knows the message id, so only it can retire the pending entry when the wait
|
|
20
|
+
ends early. A ``wait_for`` out here leaves the entry behind, and the late
|
|
21
|
+
response lands on a cancelled future and kills the receive loop.
|
|
22
|
+
- **One exception type.** ``cdp_handler`` and ``screencast`` catch
|
|
23
|
+
``cdp_client.CDPError``. The core client raises ``core.errors.CDPError``, an
|
|
24
|
+
unrelated class, and a bare ``ConnectionError``. Both are translated.
|
|
25
|
+
|
|
26
|
+
Ownership: ``one_shot_page_session`` opens the connection and the session and
|
|
27
|
+
closes both. This object closes neither.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from __future__ import annotations
|
|
31
|
+
|
|
32
|
+
import logging
|
|
33
|
+
from typing import TYPE_CHECKING, Any
|
|
34
|
+
|
|
35
|
+
from .cdp_client import CDPError
|
|
36
|
+
from .core.errors import CDPError as CoreCDPError
|
|
37
|
+
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
from .core.cdp_client import CDPClient as CoreCDPClient
|
|
40
|
+
|
|
41
|
+
logger = logging.getLogger(__name__)
|
|
42
|
+
|
|
43
|
+
#: Matches ``cdp_client.CDPClient``'s default.
|
|
44
|
+
DEFAULT_TIMEOUT_SECONDS = 30.0
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class AttachedSessionClient:
|
|
48
|
+
"""``cdp_client.CDPClient``'s surface over one attached Target session."""
|
|
49
|
+
|
|
50
|
+
def __init__(self, client: CoreCDPClient, session_id: str) -> None:
|
|
51
|
+
self._client = client
|
|
52
|
+
self._session_id = session_id
|
|
53
|
+
self._closed = False
|
|
54
|
+
# Every handler this client registered, in order, so `off` can hand
|
|
55
|
+
# the core client back the same object it was given. See `off`.
|
|
56
|
+
self._subscriptions: list[tuple[str, Any]] = []
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def session_id(self) -> str:
|
|
60
|
+
"""The attached session every send and subscription carries."""
|
|
61
|
+
return self._session_id
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def raw(self) -> CoreCDPClient:
|
|
65
|
+
"""The browser-level client underneath, for a caller that needs it.
|
|
66
|
+
|
|
67
|
+
A Step Run executes the One-Shot Session verbs by calling their
|
|
68
|
+
``*_on_session`` coroutines, which take the core client and a
|
|
69
|
+
``sessionId`` rather than this adapter. They get them from here, so
|
|
70
|
+
every step still runs on the run's one session.
|
|
71
|
+
"""
|
|
72
|
+
return self._client
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def connected(self) -> bool:
|
|
76
|
+
"""Whether the underlying connection is usable."""
|
|
77
|
+
return not self._closed and bool(getattr(self._client, "_connected", False))
|
|
78
|
+
|
|
79
|
+
async def send(
|
|
80
|
+
self,
|
|
81
|
+
method: str,
|
|
82
|
+
params: dict[str, Any] | None = None,
|
|
83
|
+
timeout: float | None = None,
|
|
84
|
+
) -> dict[str, Any]:
|
|
85
|
+
"""Send one command over the attached session and return its result.
|
|
86
|
+
|
|
87
|
+
Raises ``CDPError`` for a protocol error, a lost connection and a
|
|
88
|
+
timeout alike.
|
|
89
|
+
"""
|
|
90
|
+
if self._closed:
|
|
91
|
+
raise CDPError("Not connected to Chrome CDP")
|
|
92
|
+
deadline = DEFAULT_TIMEOUT_SECONDS if timeout is None else timeout
|
|
93
|
+
try:
|
|
94
|
+
return await self._client.send(
|
|
95
|
+
method=method,
|
|
96
|
+
params=params,
|
|
97
|
+
session_id=self._session_id,
|
|
98
|
+
timeout=deadline,
|
|
99
|
+
)
|
|
100
|
+
except CoreCDPError as exc:
|
|
101
|
+
raise CDPError(f"CDP error in {method}: {exc.message}") from exc
|
|
102
|
+
except TimeoutError as exc:
|
|
103
|
+
raise CDPError(f"CDP command timed out after {deadline}s: {method}") from exc
|
|
104
|
+
except ConnectionError as exc:
|
|
105
|
+
raise CDPError(f"Failed to send CDP command: {exc}") from exc
|
|
106
|
+
|
|
107
|
+
def on(self, event: str, handler: Any) -> None:
|
|
108
|
+
"""Subscribe to an event on this session only."""
|
|
109
|
+
self._subscriptions.append((event, handler))
|
|
110
|
+
self._client.on(event, handler, session_id=self._session_id)
|
|
111
|
+
|
|
112
|
+
def off(self, event: str, handler: Any) -> None:
|
|
113
|
+
"""Unsubscribe. A handler that was never registered is ignored.
|
|
114
|
+
|
|
115
|
+
Matching is by equality, which is what the page-level client did and
|
|
116
|
+
what callers rely on. The core client matches by identity, and
|
|
117
|
+
``obj.method`` builds a fresh bound method on every access: equal to
|
|
118
|
+
the one registered, never the same object. ``ScreencastRecorder``
|
|
119
|
+
subscribes with ``self.on_frame`` and unsubscribes with
|
|
120
|
+
``self.on_frame``, so identity matching would leave the subscription
|
|
121
|
+
in place and a reused recorder would double every frame.
|
|
122
|
+
"""
|
|
123
|
+
for index, (registered_event, registered) in enumerate(self._subscriptions):
|
|
124
|
+
if registered_event == event and registered == handler:
|
|
125
|
+
del self._subscriptions[index]
|
|
126
|
+
self._client.off(event, registered)
|
|
127
|
+
return
|
|
128
|
+
self._client.off(event, handler)
|
|
129
|
+
|
|
130
|
+
async def disconnect(self) -> None:
|
|
131
|
+
"""Mark this client unusable. The connection is not ours to close."""
|
|
132
|
+
self._closed = True
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
__all__ = ["DEFAULT_TIMEOUT_SECONDS", "AttachedSessionClient"]
|
|
@@ -357,13 +357,6 @@ def resolve_page_target_id(browser_url: str, target_spec: str) -> str | None:
|
|
|
357
357
|
return _resolve_among(pages, target_spec)
|
|
358
358
|
|
|
359
359
|
|
|
360
|
-
async def resolve_page_ws_url_async(
|
|
361
|
-
browser_url: str, target_spec: str | None = None
|
|
362
|
-
) -> str | None:
|
|
363
|
-
"""Awaitable :func:`resolve_page_ws_url`, for callers on an event loop."""
|
|
364
|
-
return await asyncio.to_thread(resolve_page_ws_url, browser_url, target_spec)
|
|
365
|
-
|
|
366
|
-
|
|
367
360
|
async def get_page_ws_url_async(browser_url: str, page_index: int = 0) -> str | None:
|
|
368
361
|
"""Awaitable :func:`get_page_ws_url`, for callers on an event loop.
|
|
369
362
|
|