dsh-wsl-playwright: Scraping Page Titles and Body Content with Headless Playwright on WSL

Preface

DeepSeek Harness (DSH) adopts a “everything is a plugin” design philosophy. In agent development, you often need to fetch web page content. Running the browser directly on the Windows side may encounter environment isolation or permission issues. The dsh-wsl-playwright plugin solves this pain point by running headless Playwright inside WSL (Windows Subsystem for Linux), allowing URLs to be opened headlessly in a Linux environment and fetching their titles and content.

Plugin Purpose

This is a DSH plugin designed to provide Playwright browser capabilities in a WSL environment. It does not include browser binaries; instead, it relies on npx and node in the system. The author is 173787247, and it is licensed under MIT.

Installation and Enablement

Install it directly using the official command; no additional environment variables are required.

dsh plugin --profile web add github:173787247/dsh-wsl-playwright

If you are using the dsh-wsl-kit suite, you can bulk-link plugins with the following command:

bash dsh-wsl-kit/scripts/link-linux-plugins.sh

Core Tools and Usage

The plugin provides two main tool commands:

  1. pw_status: Checks whether npx and node are installed in the current environment, ensuring Playwright can run.
  2. pw_fetch: Opens the specified URL headlessly and fetches the page title and content.

Usage example:

# 抓取指定 URL
pw_fetch https://example.com

The fetching behavior can be controlled via the timeoutMs and maxChars configuration items.

Notes

  1. Version Dependency: Requires DSH version >= 0.1.2.
  2. Browser Download: On first run, the plugin may need to download the Playwright browser via npx; please ensure a stable network connection.
  3. Avoid Conflicts: In the same task, do not use dsh-wsl-playwright and dsh-wsl-browser (interactive browser) simultaneously to avoid dual-driver issues.
  4. Compatibility: For specific compatibility information, refer to the documentation in the dsh-wsl-kit repository.

Summary

This plugin provides a lightweight solution for web page fetching in a Linux environment under DSH. For more details, refer to the GitHub repository: https://github.com/173787247/dsh-wsl-playwright

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye