Documentation
¶
Overview ¶
Package render is the headless Chrome step: it finds the user's installed Chrome or Chromium. refetch never downloads a browser.
Index ¶
Constants ¶
const ( OutcomeSkippedOff = "skipped_off" // render = "off" OutcomeSkippedByCall = "skipped_by_call" // fetch_page(render: false) OutcomeNoChrome = "no_chrome" // no Chrome or Chromium found OutcomeSkippedRoot = "skipped_root" // running as root, where Chrome's sandbox cannot run )
Outcomes for a step 2 that was needed but did not run.
const Client = "headless"
Client is the attempt client name of the headless Chrome step.
const DefaultTimeout = 15 * time.Second
DefaultTimeout is render_timeout's default: Chrome start included.
Variables ¶
var ( ErrNoChrome = errors.New("no Chrome or Chromium found") ErrRoot = errors.New("running as root: headless Chrome needs its sandbox, which does not run as root") ErrTimeout = errors.New("headless Chrome timed out") )
Errors Render returns.
Functions ¶
func FindChrome ¶
func FindChrome() string
FindChrome returns the Chrome to run: REFETCH_CHROME if set, then the macOS app paths (also under ~/Applications), then PATH. Empty means none.
Types ¶
type Renderer ¶
type Renderer struct {
Chrome string // binary; FindChrome() when empty
Timeout time.Duration // hard cap, Chrome start included; DefaultTimeout when zero
// contains filtered or unexported fields
}
Renderer runs the user's Chrome headless, behind a local proxy on the public-only dialer, and returns the DOM after the page's scripts ran.