@FakeMaidenMaker: Puppeteer 能让程序自己打开浏览器,像人一样点鼠标、输文字、抓页面内容,干活根本不用你盯着。 GitHub 上有 95k Star,是浏览器自动化领域绝对的标杆项目。 GitHub:https://github.com/puppe…
摘要
Puppeteer 是一个流行的浏览器自动化 JavaScript 库,支持控制 Chrome 和 Firefox,可用于网页抓取、自动化测试等场景,最近还集成了 MCP 协议以支持 AI 代理直接操控浏览器。
查看缓存全文
缓存时间: 2026/06/22 17:50
Puppeteer 能让程序自己打开浏览器,像人一样点鼠标、输文字、抓页面内容,干活根本不用你盯着。
GitHub 上有 95k Star,是浏览器自动化领域绝对的标杆项目。
GitHub:https://github.com/puppeteer/puppeteer…
以前要每天手动登录某个网站抓数据、填表、测某个网页功能,重复点来点去特别烦,用录屏宏工具还很脆弱,网页一改版就失效。换
成 Puppeteer 之后,写几行代码就能控制 Chrome 或 Firefox,模拟点击搜索框、输入关键词、点结果、把页面文字抓下来,整套流程默认无界面运行,可以丢给后台自己跑完,人不用管。
更有意思的是它还有 MCP:
Puppeteer 做的 chrome-devtools-mcp,让 AI agent 能直接通过 MCP 协议操控浏览器、调试网页。
也就是说现在不止程序员在用它写自动化脚本,AI agent 也能拿它当手去点网页。
puppeteer/puppeteer
Source: https://github.com/puppeteer/puppeteer
Puppeteer
Puppeteer is a JavaScript library which provides a high-level API to control Chrome or Firefox over the DevTools Protocol or WebDriver BiDi. Puppeteer runs in the headless (no visible UI) by default
Get started | API | FAQ | Contributing | Troubleshooting
Installation
npm i puppeteer # Downloads compatible Chrome during installation.
npm i puppeteer-core # Alternatively, install as a library, without downloading Chrome.
:::note
Modern package managers (including npm (see the RFC), pnpm, Yarn, Bun, and Deno) block dependency install scripts by default. If the install script is blocked, Puppeteer will not download the browser during installation, leading to runtime errors.
You can manually download the required browsers after installation by running:
npx puppeteer browsers install
Alternatively, you can configure your package manager to allow the install script to run (for example, with npm, by adding "puppeteer" to "allowScripts" in your package.json).
:::
MCP
Install chrome-devtools-mcp,
a Puppeteer-based MCP server for browser automation and debugging.
Puppeteer also supports the experimental WebMCP API.
Example
import puppeteer from 'puppeteer';
// Or import puppeteer from 'puppeteer-core';
// Launch the browser and open a new blank page.
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Navigate the page to a URL.
await page.goto('https://developer.chrome.com/');
// Set the screen size.
await page.setViewport({width: 1080, height: 1024});
// Open the search menu using the keyboard.
await page.keyboard.press('/');
// Type into search box using accessible input name.
await page.locator('::-p-aria(Search)').fill('automate beyond recorder');
// Wait and click on first result.
await page.locator('.devsite-result-item-link').click();
// Locate the full title with a unique string.
const textSelector = await page
.locator('::-p-text(Customize and automate)')
.waitHandle();
const fullTitle = await textSelector?.evaluate(el => el.textContent);
// Print the full title.
console.log('The title of this blog post is "%s".', fullTitle);
await browser.close();
相似文章
@GitHub_Daily: 让 AI Agent 自动化操作浏览器或抓数据,经常被各种反爬机制拦截,遇到验证码、人机验证直接卡死。 最近 BrowserAct 团队开源了一个 Skill,专为 AI Agent 设计的浏览器自动化命令行工具。 提供三层反封锁机制,从…
BrowserAct 团队开源了一个专为 AI Agent 设计的浏览器自动化命令行工具,提供三层反封锁机制(指纹伪装、验证码破解、人类接管),支持多浏览器并行、账户隔离,并优化了输出格式以节省Token。
puppeteer/puppeteer
Puppeteer 是一个 JavaScript 库,提供高级 API,通过 DevTools 协议控制 Chrome/Chromium,常用于浏览器自动化、网页抓取和测试。
@GoJun315: 一位 16 岁开发者,开源了一个无头浏览器引擎,专为爬虫和 AI Agent 自动化设计。 项目名叫 Obscura,使用 Rust 构建,已狂揽 14600+ GitHub Star。 与 headless Chrome 对比优势明显:…
一位16岁开发者开源了基于Rust的无头浏览器引擎Obscura,专为爬虫和AI Agent自动化设计,内存占用仅30MB,已获得超14600 GitHub星标。
@quant_sheep: 我让 Agent 通过 Chrome 帮我在 Airbnb 上找住处并完成预约了 它甚至还主动帮我咨询房东:有没有厨房 如果你需要让自己的 Agent 像人一样操作浏览器,不管是测试网页,还是自动预订 Airbnb 住宿,涉及网页的操作都…
展示了一个名为 open-browser-use 的开源工具,能让 AI Agent 像人一样操作 Chrome 浏览器,完成在 Airbnb 上查找住处并预约的全流程,包括主动咨询房东。
@geekbb: Browser-use 团队用 Rust 编写的终端 TUI 工具,你用自然语言告诉它做什么,它就去控制浏览器完成。自研的 LLM 引擎加上 Chrome 的 CDP 协议,支持用你登录态的 Chrome、无头浏览器或者 Browser …
Browser-use 团队推出了一款用 Rust 编写的终端 TUI 工具,允许用户通过自然语言控制浏览器,支持使用登录态 Chrome、无头浏览器或 Browser Use 云端运行。