rod

go-rodMIT活跃维护

用 Go 写的 Chrome DevTools Protocol 驱动,直接操控浏览器做网页自动化和爬虫,省去手动管理浏览器进程的麻烦。

A Chrome DevTools Protocol driver for web automation and scraping.

v0.116.2发布于 2024-07-12 11:52 UTC7,148star +2 / 7 天487fork同步于 2026-11-10 17:34 UTC

怎么上手

由 README 提炼,执行前请确认
go get github.com/go-rod/rod
硬件要求按 README 说明

README 未说明具体硬件要求;运行时需要 Chrome 类浏览器,可由库自动查找或下载。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 DevTools Protocol 的 Go 浏览器自动化与爬虫驱动,高层 API 开箱即用

用 Go 写的 Chrome DevTools Protocol 驱动,直接操控浏览器做网页自动化和爬虫,省去手动管理浏览器进程的麻烦。

核心能力

  • 链式 context 设计,便于超时与取消长任务
  • 自动等待元素就绪,减少手写轮询
  • 自动查找或下载浏览器
  • 支持嵌套 iframe 与 shadow DOM 定位
  • 提供 WaitStable、HijackRequests、WaitDownload 等高层助手

容易踩的坑

首次运行可能需要联网下载浏览器,离线环境需自行准备;README 未给出具体安装命令示例,需参考 examples_test.go 与 lib/examples 上手

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.116.2
  1. v0.116.2最新正式版2024-07-12 · 2024-07-12 11:52 UTC

    What's Changed

    New Contributors

    Full Changelog: https://github.com/go-rod/rod/compare/v0.116.1...v0.116.2

  2. v0.116.12024-06-17 · 2024-06-17 09:09 UTC
    查看更新说明

    Fixed #548 OOPIF iframe issue.

    Full Changelog: https://github.com/go-rod/rod/compare/v0.116.0...v0.116.1

  3. v0.116.02024-05-06 · 2024-05-06 05:15 UTC
    查看更新说明

    There are breaking changes on the PagePool and BrowserPool.

    What's Changed

    Full Changelog: https://github.com/go-rod/rod/compare/v0.115.0...v0.116.0

  4. v0.115.02024-04-17 · 2024-04-17 03:51 UTC
    查看更新说明

    There's a breaking change, now if you want the same behavior before, you have to manually call the Launcher.AlwaysOpenPDFExternally.

    Full Changelog: https://github.com/go-rod/rod/compare/v0.114.8...v0.115.0

  5. v0.114.82024-03-06 · 2024-03-06 12:36 UTC
    查看更新说明

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Overview

    Go Reference Discord Chat

    Documentation | API reference | FAQ

    Rod is a high-level driver directly based on DevTools Protocol. It's designed for web automation and scraping for both high-level and low-level use, senior developers can use the low-level packages and functions to easily customize or build up their own version of Rod, the high-level functions are just examples to build a default version of Rod.

    中文 API 文档

    Features

    • Chained context design, intuitive to timeout or cancel the long-running task
    • Auto-wait elements to be ready
    • Debugging friendly, auto input tracing, remote monitoring headless browser
    • Thread-safe for all operations
    • Automatically find or download browser
    • High-level helpers like WaitStable, WaitRequestIdle, HijackRequests, WaitDownload, etc
    • Two-step WaitEvent design, never miss an event (how it works)
    • Correctly handles nested iframes or shadow DOMs
    • No zombie browser process after the crash (how it works)
    • CI enforced 100% test coverage

    Examples

    Please check the examples_test.go file first, then check the examples folder.

    For more detailed examples, please search the unit tests. Such as the usage of method HandleAuth, you can search all the *_test.go files that contain HandleAuth, for example, use GitHub online search in repository. You can also search the GitHub issues or discussions, a lot of usage examples are recorded there.

    Here is a comparison of the examples between rod and Chromedp.

    If you have questions, please raise an issues/discussions or join the chat room.

    Sponsors

    Rod is sponsored by many organizations and individuals, thank you for your support!

    Please contact [email protected] if you want to be listed here.

    Join us

    Your help is more than welcome! Even just open an issue to ask a question may greatly help others.

    Please read How To Ask Questions The Smart Way before you ask questions.

    If you want to contribute please read the Contributor Guide.