A DrissionPage-based browser automation skill for web research, scraping, and browser-driven tasks.
This repository is intentionally opinionated about browser startup. The main goal is not just to list DrissionPage APIs, but to make browser automation behave predictably in a real workspace.
- Browser automation with explicit startup validation
- Web scraping and search
- Network request listening
- Screenshot-based evidence capture
- User intervention support for login and captcha flows
- Structured research output with source tracking
drissionpage-browser/
├── SKILL.md # Main skill instructions
├── scripts/
│ └── quick_start.py # Startup validation example
└── evals/
└── evals.json # Behavior-focused evals
drissionpage-browser.skill # Packaged skill file
- Python 3.7+
- DrissionPage:
pip install DrissionPage - A runnable Chromium-based browser executable path
Recommended default:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Other common macOS candidates:
/Applications/Chromium.app/Contents/MacOS/Chromium
/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge
Recommended default:
C:\Program Files\Google\Chrome\Application\chrome.exe
Other common Windows candidates:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
C:\Program Files\Chromium\Application\chrome.exe
C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
The skill uses this startup priority:
- User-provided browser path, port, and launch arguments
- Previously validated workspace settings
- Platform default path
- If none work, stop and report the startup problem
Do not fall back to bare Chromium() once a verified path or user-provided configuration exists.
Prefer auto_port() for default startup. Use a fixed port only when you intentionally manage a specific browser instance.
import sys
from pathlib import Path
from DrissionPage import Chromium, ChromiumOptions
import os
chrome_path = os.environ.get(
'DRISSIONPAGE_BROWSER_PATH',
r'C:\Program Files\Google\Chrome\Application\chrome.exe'
if sys.platform.startswith('win')
else '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
)
if not Path(chrome_path).exists():
raise FileNotFoundError(f'Browser not found: {chrome_path}')
co = ChromiumOptions()
co.set_browser_path(chrome_path)
co.auto_port()
browser = Chromium(addr_or_opts=co)
tab = browser.latest_tab
tab.get('https://example.com')
tab.wait.doc_loaded()
print(tab.title)
print(tab.url)Run the included validation script:
# macOS / Linux
python3 drissionpage-browser/scripts/quick_start.py
# Windows
python drissionpage-browser/scripts/quick_start.pyWhat it does:
- resolves a browser path using explicit priority
- enables
auto_port()to avoid fragile fixed-port startup - verifies startup with
https://example.com - opens Baidu and runs a basic search
- prints page title, URL, and result count
The default workflow for this skill is:
- Resolve and validate browser startup
- Open the target page
- Extract facts, links, or structured data
- Record source title and source URL
- Capture screenshots for key pages
- Return structured output
Recommended minimum output fields:
- source title
- source URL
- core finding
- slide-ready sentence
- visualization suggestion
- whether manual review is needed
When startup fails, diagnose in this order:
- Browser path exists
ChromiumOptionssetup is correct- If you see a WebSocket 404 during startup, retry with
auto_port() - Browser can launch manually
DrissionPageis installed correctly- Connection or port mismatch
- Only then inspect page logic
- Search engine queries
- News collection
- Research with evidence capture
- Link extraction
- Browser-based debugging
- Form automation
The skill includes examples for:
- Baidu hot topics
- Bilibili video listing
- Weibo hot search
- Zhihu hot list
See SKILL.md for the full skill instructions.
Install drissionpage-browser.skill into your skill manager, or place the drissionpage-browser/ directory in your skills folder.
基于 DrissionPage 的浏览器自动化 Skill,用于网页研究、抓取和浏览器驱动任务。
这个仓库的重点不是单纯罗列 DrissionPage API,而是把浏览器启动、验证、排障和结构化输出写成可执行约束。
- 显式浏览器启动与验证
- 网页搜索与抓取
- 网络请求监听
- 截图留证
- 登录与验证码场景的人工介入
- 结构化研究输出
drissionpage-browser/
├── SKILL.md # Skill 主文档
├── scripts/
│ └── quick_start.py # 启动验证示例
└── evals/
└── evals.json # 行为导向测试
drissionpage-browser.skill # 打包产物
- Python 3.7+
- DrissionPage:
pip install DrissionPage - 一个可执行的 Chromium 系浏览器路径
推荐默认值:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
其他常见候选:
/Applications/Chromium.app/Contents/MacOS/Chromium
/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge
推荐默认值:
C:\Program Files\Google\Chrome\Application\chrome.exe
其他常见候选:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
C:\Program Files\Chromium\Application\chrome.exe
C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
Skill 的浏览器启动优先级如下:
- 用户提供的路径、端口、启动参数
- 已验证通过的工作区配置
- 当前平台默认路径
- 如果都不可用,直接报告启动问题并停止
一旦已经有可用路径或用户给定配置,不要再回退到裸 Chromium()。
默认启动优先使用 auto_port();只有在你明确管理某个浏览器实例时才使用固定端口。
import sys
from pathlib import Path
from DrissionPage import Chromium, ChromiumOptions
import os
chrome_path = os.environ.get(
'DRISSIONPAGE_BROWSER_PATH',
r'C:\Program Files\Google\Chrome\Application\chrome.exe'
if sys.platform.startswith('win')
else '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
)
if not Path(chrome_path).exists():
raise FileNotFoundError(f'Browser not found: {chrome_path}')
co = ChromiumOptions()
co.set_browser_path(chrome_path)
co.auto_port()
browser = Chromium(addr_or_opts=co)
tab = browser.latest_tab
tab.get('https://example.com')
tab.wait.doc_loaded()
print(tab.title)
print(tab.url)运行仓库自带验证脚本:
# macOS / Linux
python3 drissionpage-browser/scripts/quick_start.py
# Windows
python drissionpage-browser/scripts/quick_start.py脚本会:
- 按明确优先级解析浏览器路径
- 默认启用
auto_port(),避免依赖固定端口 - 先用
https://example.com验证启动 - 再打开百度执行一次基础搜索
- 输出标题、URL 和结果数量
默认流程:
- 解析并验证浏览器启动
- 打开目标页面
- 提取事实、链接或结构化数据
- 记录来源标题和来源 URL
- 对关键页面截图留证
- 返回结构化结果
建议最少输出字段:
- 来源标题
- 来源 URL
- 核心结论
- 可上 slide 的一句话
- 可视化建议
- 是否需要人工复核
浏览器启动失败时按这个顺序查:
- 浏览器路径是否存在
ChromiumOptions是否配置正确- 如果启动时遇到 WebSocket 404,优先改用
auto_port() - 浏览器能否手动启动
DrissionPage是否安装正确- 是否连到了错误的端口或实例
- 只有这些都确认后,再查页面逻辑
- 搜索引擎查询
- 新闻采集
- 带证据留存的研究任务
- 链接提取
- 浏览器调试
- 表单自动化
- 百度热搜
- B 站视频列表
- 微博热搜
- 知乎热榜
完整说明见 SKILL.md。
将 drissionpage-browser.skill 安装到你的 skill 管理工具中,或将 drissionpage-browser/ 目录放到 skills 目录下。