首次运行可能需要联网下载浏览器,离线环境需自行准备;README 未给出具体安装命令示例,需参考 examples_test.go 与 lib/examples 上手
rod
go-rodMIT活跃维护用 Go 写的 Chrome DevTools Protocol 驱动,直接操控浏览器做网页自动化和爬虫,省去手动管理浏览器进程的麻烦。
A Chrome DevTools Protocol driver for web automation and scraping.
go get github.com/go-rod/rodREADME 未说明具体硬件要求;运行时需要 Chrome 类浏览器,可由库自动查找或下载。
基于 DevTools Protocol 的 Go 浏览器自动化与爬虫驱动,高层 API 开箱即用
用 Go 写的 Chrome DevTools Protocol 驱动,直接操控浏览器做网页自动化和爬虫,省去手动管理浏览器进程的麻烦。
核心能力
- 链式 context 设计,便于超时与取消长任务
- 自动等待元素就绪,减少手写轮询
- 自动查找或下载浏览器
- 支持嵌套 iframe 与 shadow DOM 定位
- 提供 WaitStable、HijackRequests、WaitDownload 等高层助手
容易踩的坑
- v0.116.2最新正式版2024-07-12 · 2024-07-12 11:52 UTC
What's Changed
- feat: add support for Page.ResetNavigationHistory by @jackcipher in https://github.com/go-rod/rod/pull/1087
- Update docker runner image to latest ubuntu lts by @gotha in https://github.com/go-rod/rod/pull/1088
New Contributors
- @jackcipher made their first contribution in https://github.com/go-rod/rod/pull/1087
- @gotha made their first contribution in https://github.com/go-rod/rod/pull/1088
Full Changelog: https://github.com/go-rod/rod/compare/v0.116.1...v0.116.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
- v0.116.02024-05-06 · 2024-05-06 05:15 UTC
查看更新说明
There are breaking changes on the
PagePoolandBrowserPool.What's Changed
- Feat: Add the PagePool.TryGet method while it returns an error for processing. by @zeoxisca in https://github.com/go-rod/rod/pull/1051
Full Changelog: https://github.com/go-rod/rod/compare/v0.115.0...v0.116.0
- 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
- v0.114.82024-03-06 · 2024-03-06 12:36 UTC
查看更新说明
Full Changelog: https://github.com/go-rod/rod/compare/v0.114.7...v0.114.8
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Overview
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.
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.