chromium

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package chromium 通过 CDP 管理共享浏览器及每次渲染的独立上下文。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(executable string) func() (htmlrender.Engine, error)

New 返回登记到 htmlrender.EngineConfig 的构造函数。首次调用启动浏览器, 同一构造函数创建的并发实例共享该浏览器,每个任务仍使用独立页面; executable 为空时由 chromedp 查找浏览器程序。

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine 持有共享浏览器;每次 Render 创建独立页面上下文。

func (*Engine) Close

func (b *Engine) Close() error

Close 关闭共享浏览器,并保留第一次关闭的结果。

func (*Engine) Err

func (b *Engine) Err() error

Err 返回共享浏览器当前的退出或连接错误,供运行状态检查使用。

func (*Engine) Render

func (b *Engine) Render(ctx context.Context, content htmlrender.Page) (image.Image, error)

Render 等待页面、字体与图片就绪,返回整页、viewport 或指定元素的截图。 浏览器已退出时为本次新请求重建;执行中的请求失败后保留错误,不重复执行页面。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL