A long-lived browser session.
Each Rover.Browser owns one rover_runtime OS process. The subprocess in
turn owns exactly one Servo instance and one WebView — so one browser =
one isolated rendering context with its own proxy, cookies, and network
state.
Call start_link/1 to open a browser, then drive it with the functions in
the top-level Rover module:
{:ok, browser} = Rover.Browser.start_link(proxy: "http://proxy:8080")
:ok = Rover.navigate(browser, "https://example.com")
{:ok, html} = Rover.content(browser)
Rover.stop(browser)The process is meant to be added to your own supervisor. If you just need a
page's rendered HTML, reach for Rover.fetch/2 — it spins a browser up,
runs your operation, and tears it down.
Lifecycle
start_link/1blocks until the runtime reportsHelloand accepts itsInit. A failed init returns{:error, %Rover.Error{}}— the GenServer does not start.- If the runtime subprocess crashes, the GenServer exits with reason
{:port_died, details}and pending callers receive{:error, %Rover.Error{reason: :port_died}}. Use a supervisor to restart the browser.
Summary
Functions
Returns a specification to start this module under a supervisor.
Start a browser linked to the caller.
Shut the browser down cleanly.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(keyword()) :: GenServer.on_start()
Start a browser linked to the caller.
Options
:proxy— HTTP/HTTPS proxy URI ("http://host:port"or with"http://user:pass@host:port"). Baked into the engine for the lifetime of this browser. Default: direct (no proxy).:user_agent— custom User-Agent string. Default: Servo's default.:viewport—{width, height}in CSS pixels. Default:{1280, 720}.:name— standard GenServer registration name.:runtime_path— override the path to the runtime binary; useful for tests. Default: resolved byRover.Runtime.:init_timeout— how long to wait for the runtime to acceptInit. Default: 30s.
@spec stop(GenServer.server(), timeout()) :: :ok
Shut the browser down cleanly.
Sends Shutdown to the runtime and waits for it to exit, then terminates
the GenServer. Returns :ok even if the runtime was already gone.