Preface¶
The built-in web_fetch tool in DeepSeek Harness (DSH) retrieves webpage text through HTTP requests, but it cannot execute JavaScript rendering or perform interactive operations. dsh-plugin-browser is a community plugin that drives a headless browser via Playwright, providing the model with the ability to render pages, extract text, take screenshots, and automate interactions, thereby addressing the limitations of the basic web-fetching tool.
Plugin Overview¶
This is a DSH community plugin categorized under “Web Tools,” maintained by xu1132 under the MIT license. It registers 6 model-callable tools through Playwright, enabling large language models to browse webpages, read dynamic content, and manipulate page elements like a human user.
Core Features¶
The plugin provides the following capabilities:
- Page Navigation and Rendering: Opens a URL, waits for the page to load, and returns the rendered title, body text, and list of links.
- Content Extraction: Retrieves the rendered text of the current page for checking state between automation steps.
- Interactive Operations: Clicks elements and fills text input fields using Playwright CSS selectors.
- Screenshot: Captures the viewport content and saves it as a PNG image, stored by default in the configured directory.
- Session Management: Closes browser sessions and releases resources.
Installation and Configuration¶
Install the Plugin¶
dsh plugin --profile demo add github:xu1132/dsh-plugin-browser
Prepare Dependencies¶
By default, the plugin uses the Chromium bundled with Playwright. Before first use, install the browser binary in the profile directory:
npx playwright install chromium
Configuration Options¶
You can override the default configuration using cordis.patch.yml in the profile directory. For example:
- id: browser
name: dsh-plugin-browser
config:
timeoutMs: 30000 # 导航、点击、输入的超时时间
maxTextChars: 20000 # 单次快照提取的最大字符数
maxLinks: 20 # 单次快照列出的最大链接数
screenshotDir: . # 截图保存目录
executablePath: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome # 指定系统浏览器路径
Typical Use Cases¶
- Reading Dynamic Content: Let the model access a page rendered by JavaScript and extract information from it.
- Automated Interaction: Simulate user actions such as clicking buttons or entering text.
- Capturing Snapshots: Obtain the rendered text of the current page between automation steps.
Notes¶
- Session Isolation: Each Agent has an independent browser session; calls without an associated Agent share a default session.
- Launch Timing: Sessions are launched on demand at first use and are automatically closed when the plugin is uninstalled.
- Permissions and Security: The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before use.
Summary¶
This plugin extends DSH’s capabilities in browser automation and is suitable for scenarios involving SPA applications, dynamic data scraping, or simulating user operations.