drissionpage-cli 0.1.1__tar.gz → 0.1.2__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.
Files changed (22) hide show
  1. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/PKG-INFO +6 -2
  2. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/README.md +5 -1
  3. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/__init__.py +11 -2
  4. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/skills/drissionpage-cli/SKILL.md +3 -1
  5. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/skills/drissionpage-cli/references/session-management.md +4 -1
  6. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli.egg-info/PKG-INFO +6 -2
  7. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/pyproject.toml +1 -1
  8. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/tests/test_unit.py +63 -1
  9. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/LICENSE +0 -0
  10. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/skills/drissionpage-cli/references/dual-mode.md +0 -0
  11. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/skills/drissionpage-cli/references/element-locators.md +0 -0
  12. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/skills/drissionpage-cli/references/network-listening.md +0 -0
  13. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/skills/drissionpage-cli/references/running-code.md +0 -0
  14. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/skills/drissionpage-cli/references/screenshots-pdf.md +0 -0
  15. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli/skills/drissionpage-cli/references/storage-state.md +0 -0
  16. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli.egg-info/SOURCES.txt +0 -0
  17. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli.egg-info/dependency_links.txt +0 -0
  18. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli.egg-info/entry_points.txt +0 -0
  19. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli.egg-info/requires.txt +0 -0
  20. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/drissionpage_cli.egg-info/top_level.txt +0 -0
  21. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/setup.cfg +0 -0
  22. {drissionpage_cli-0.1.1 → drissionpage_cli-0.1.2}/tests/test_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drissionpage-cli
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: DrissionPage CLI - Token-efficient browser automation for coding agents
5
5
  Author: DrissionPage-MCP Contributors
6
6
  License: Apache-2.0
@@ -25,11 +25,15 @@ Requires-Dist: DrissionPage>=4.0.0
25
25
  Dynamic: license-file
26
26
 
27
27
  # DrissionPage-cli
28
-
29
28
  Token-efficient browser automation CLI for coding agents, powered by [DrissionPage](https://DrissionPage.cn).
30
29
 
31
30
  Mirrors the architecture of [playwright-cli](https://github.com/microsoft/playwright-cli) but uses DrissionPage as the backend — pure Python, no Node.js required.
32
31
 
32
+ ## Why use drissionpage-cli
33
+
34
+ If you know, you know. If you don't, go use playwright-cli.
35
+
36
+
33
37
  ## Why CLI + Skills over MCP
34
38
 
35
39
  Modern coding agents (Claude Code, GitHub Copilot, etc.) increasingly favour CLI-based workflows exposed as **SKILLs** over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context. This makes CLI + SKILLs better suited for high-throughput agents that must balance browser automation with large codebases within limited context windows.
@@ -1,9 +1,13 @@
1
1
  # DrissionPage-cli
2
-
3
2
  Token-efficient browser automation CLI for coding agents, powered by [DrissionPage](https://DrissionPage.cn).
4
3
 
5
4
  Mirrors the architecture of [playwright-cli](https://github.com/microsoft/playwright-cli) but uses DrissionPage as the backend — pure Python, no Node.js required.
6
5
 
6
+ ## Why use drissionpage-cli
7
+
8
+ If you know, you know. If you don't, go use playwright-cli.
9
+
10
+
7
11
  ## Why CLI + Skills over MCP
8
12
 
9
13
  Modern coding agents (Claude Code, GitHub Copilot, etc.) increasingly favour CLI-based workflows exposed as **SKILLs** over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context. This makes CLI + SKILLs better suited for high-throughput agents that must balance browser automation with large codebases within limited context windows.
@@ -15,7 +15,7 @@ import time
15
15
  import traceback
16
16
  from pathlib import Path
17
17
 
18
- __version__ = "0.1.1"
18
+ __version__ = "0.1.2"
19
19
 
20
20
  # Session storage directory
21
21
  CLI_DIR = Path(os.environ.get("DRISSIONPAGE_CLI_DIR", ".drissionpage-cli"))
@@ -108,7 +108,13 @@ def _get_page(session_name, create=False, options=None):
108
108
 
109
109
  # Create new session
110
110
  co = ChromiumOptions()
111
- co.auto_port() # pick a free port to avoid conflicts with stale browsers
111
+
112
+ use_system_user_path = options and options.get("system_user_path")
113
+ if use_system_user_path:
114
+ # use_system_user_path is incompatible with auto_port (auto_port creates a temp profile)
115
+ co.use_system_user_path(True)
116
+ else:
117
+ co.auto_port() # pick a free port to avoid conflicts with stale browsers
112
118
 
113
119
  if options:
114
120
  if options.get("headless") is not None:
@@ -216,6 +222,7 @@ def cmd_open(args):
216
222
  "headless": not getattr(args, "headed", False),
217
223
  "user_data_path": getattr(args, "profile", None),
218
224
  "port": getattr(args, "port", None),
225
+ "system_user_path": getattr(args, "system_user_path", False),
219
226
  }
220
227
  page = _get_page(session, create=True, options=options)
221
228
 
@@ -1105,6 +1112,8 @@ def build_parser():
1105
1112
  p.add_argument("url", nargs="?", help="URL to navigate to")
1106
1113
  p.add_argument("--headed", action="store_true", help="Run in headed mode")
1107
1114
  p.add_argument("--profile", help="User data directory path")
1115
+ p.add_argument("--system-user-path", action="store_true", dest="system_user_path",
1116
+ help="Use system default Chrome profile (inherits login sessions)")
1108
1117
  p.add_argument("--port", type=int, help="CDP debugging port")
1109
1118
  p.set_defaults(func=cmd_open)
1110
1119
 
@@ -146,7 +146,9 @@ drissionpage-cli run-code --filename=script.py
146
146
  ```bash
147
147
  # Run in headed mode (browser window visible)
148
148
  drissionpage-cli open --headed
149
- # Use persistent user profile
149
+ # Use system default Chrome profile (inherits all login sessions)
150
+ drissionpage-cli open --system-user-path
151
+ # Use a specific user profile directory
150
152
  drissionpage-cli open --profile=/path/to/profile
151
153
  # Use specific CDP port
152
154
  drissionpage-cli open --port=9222
@@ -90,7 +90,10 @@ drissionpage-cli -s=variant-b screenshot
90
90
  ### Persistent Profile
91
91
 
92
92
  ```bash
93
- # Use persistent profile
93
+ # Use system default Chrome profile (inherits all login sessions)
94
+ drissionpage-cli open --system-user-path
95
+
96
+ # Use a specific profile directory
94
97
  drissionpage-cli open https://example.com --profile=/path/to/profile
95
98
 
96
99
  # Specific CDP port
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drissionpage-cli
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: DrissionPage CLI - Token-efficient browser automation for coding agents
5
5
  Author: DrissionPage-MCP Contributors
6
6
  License: Apache-2.0
@@ -25,11 +25,15 @@ Requires-Dist: DrissionPage>=4.0.0
25
25
  Dynamic: license-file
26
26
 
27
27
  # DrissionPage-cli
28
-
29
28
  Token-efficient browser automation CLI for coding agents, powered by [DrissionPage](https://DrissionPage.cn).
30
29
 
31
30
  Mirrors the architecture of [playwright-cli](https://github.com/microsoft/playwright-cli) but uses DrissionPage as the backend — pure Python, no Node.js required.
32
31
 
32
+ ## Why use drissionpage-cli
33
+
34
+ If you know, you know. If you don't, go use playwright-cli.
35
+
36
+
33
37
  ## Why CLI + Skills over MCP
34
38
 
35
39
  Modern coding agents (Claude Code, GitHub Copilot, etc.) increasingly favour CLI-based workflows exposed as **SKILLs** over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context. This makes CLI + SKILLs better suited for high-throughput agents that must balance browser automation with large codebases within limited context windows.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "drissionpage-cli"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "DrissionPage CLI - Token-efficient browser automation for coding agents"
9
9
  readme = "README.md"
10
10
  license = {text = "Apache-2.0"}
@@ -26,7 +26,7 @@ import drissionpage_cli as cli
26
26
 
27
27
  class TestVersionAndHelp:
28
28
  def test_version_string(self):
29
- assert cli.__version__ == "0.1.0"
29
+ assert cli.__version__ == "0.1.2"
30
30
 
31
31
  def test_build_parser(self):
32
32
  parser = cli.build_parser()
@@ -292,6 +292,17 @@ class TestVersionAndHelp:
292
292
  assert args.command == "open"
293
293
  assert args.profile == "/tmp/profile"
294
294
 
295
+ def test_parse_open_with_system_user_path(self):
296
+ parser = cli.build_parser()
297
+ args = parser.parse_args(["open", "--system-user-path"])
298
+ assert args.command == "open"
299
+ assert args.system_user_path is True
300
+
301
+ def test_parse_open_system_user_path_default_false(self):
302
+ parser = cli.build_parser()
303
+ args = parser.parse_args(["open"])
304
+ assert args.system_user_path is False
305
+
295
306
  def test_parse_console_command(self):
296
307
  parser = cli.build_parser()
297
308
  args = parser.parse_args(["console", "warning"])
@@ -578,6 +589,57 @@ class TestStateSaveLoad:
578
589
  assert any("sessionStorage.setItem" in str(call) for call in mock_page.run_js.call_args_list)
579
590
 
580
591
 
592
+ # ---------------------------------------------------------------------------
593
+ # _get_page options (mocked ChromiumOptions / ChromiumPage)
594
+ # ---------------------------------------------------------------------------
595
+
596
+
597
+ class TestGetPageOptions:
598
+ """Test that _get_page passes options correctly to ChromiumOptions."""
599
+
600
+ def _make_mock_co(self):
601
+ return MagicMock()
602
+
603
+ def _run_get_page(self, options, tmp_path, mock_co, mock_page):
604
+ sessions_file = tmp_path / "sessions.json"
605
+ cli_dir_path = tmp_path / ".drissionpage-cli"
606
+ cli_dir_path.mkdir()
607
+
608
+ with patch.object(cli, "SESSIONS_FILE", sessions_file), \
609
+ patch.object(cli, "CLI_DIR", cli_dir_path), \
610
+ patch("DrissionPage.ChromiumOptions", return_value=mock_co), \
611
+ patch("DrissionPage.ChromiumPage", return_value=mock_page):
612
+ mock_page.address = "127.0.0.1:9333"
613
+ mock_page.process_id = 999
614
+ cli._get_page("default", create=True, options=options)
615
+
616
+ def test_system_user_path_calls_use_system_user_path(self, tmp_path):
617
+ mock_co = self._make_mock_co()
618
+ mock_page = MagicMock()
619
+ self._run_get_page({"system_user_path": True}, tmp_path, mock_co, mock_page)
620
+ mock_co.use_system_user_path.assert_called_once_with(True)
621
+
622
+ def test_system_user_path_skips_auto_port(self, tmp_path):
623
+ mock_co = self._make_mock_co()
624
+ mock_page = MagicMock()
625
+ self._run_get_page({"system_user_path": True}, tmp_path, mock_co, mock_page)
626
+ mock_co.auto_port.assert_not_called()
627
+
628
+ def test_no_system_user_path_calls_auto_port(self, tmp_path):
629
+ mock_co = self._make_mock_co()
630
+ mock_page = MagicMock()
631
+ self._run_get_page({"system_user_path": False}, tmp_path, mock_co, mock_page)
632
+ mock_co.auto_port.assert_called_once()
633
+ mock_co.use_system_user_path.assert_not_called()
634
+
635
+ def test_system_user_path_with_headed(self, tmp_path):
636
+ mock_co = self._make_mock_co()
637
+ mock_page = MagicMock()
638
+ self._run_get_page({"system_user_path": True, "headless": False}, tmp_path, mock_co, mock_page)
639
+ mock_co.use_system_user_path.assert_called_once_with(True)
640
+ mock_co.headless.assert_called_once_with(False)
641
+
642
+
581
643
  # ---------------------------------------------------------------------------
582
644
  # Command handlers (mocked browser)
583
645
  # ---------------------------------------------------------------------------