# `Jido.Browser`
[🔗](https://github.com/agentjido/jido_browser/blob/v2.1.0/lib/jido_browser.ex#L1)

Browser automation for Jido AI agents.

`Jido.Browser` provides a flat browser API backed by pluggable adapters.
In 2.0, the default adapter is `Jido.Browser.Adapters.AgentBrowser`.

# `back`

```elixir
@spec back(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Navigates back in browser history.

# `click`

```elixir
@spec click(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Clicks an element identified by a selector or agent-browser ref.

# `close_tab`

```elixir
@spec close_tab(Jido.Browser.Session.t(), non_neg_integer() | nil, keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Closes the current tab or a specific tab by index.

# `console`

```elixir
@spec console(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Returns captured browser console messages when supported by the adapter.

# `end_session`

```elixir
@spec end_session(Jido.Browser.Session.t()) :: :ok | {:error, term()}
```

Ends an active browser session.

# `errors`

```elixir
@spec errors(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Returns captured browser runtime errors when supported by the adapter.

# `evaluate`

```elixir
@spec evaluate(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Evaluates JavaScript in the browser when the adapter supports it.

# `extract_content`

```elixir
@spec extract_content(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Extracts page content as markdown, HTML, or text.

# `focus`

```elixir
@spec focus(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Focuses an element.

# `forward`

```elixir
@spec forward(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Navigates forward in browser history.

# `get_attribute`

```elixir
@spec get_attribute(Jido.Browser.Session.t(), String.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Reads an attribute value from an element.

# `get_status`

```elixir
@spec get_status(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Returns the current session status, including URL, title, and liveness.

# `get_text`

```elixir
@spec get_text(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Reads text content from one or more matching elements.

# `get_title`

```elixir
@spec get_title(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Returns the current page title.

# `get_url`

```elixir
@spec get_url(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Returns the current page URL.

# `hover`

```elixir
@spec hover(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Moves the pointer over an element.

# `is_visible`

```elixir
@spec is_visible(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Checks whether an element exists and is visible.

# `list_tabs`

```elixir
@spec list_tabs(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Lists open browser tabs.

# `load_state`

```elixir
@spec load_state(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Restores browser session state from disk.

# `navigate`

```elixir
@spec navigate(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Navigates the current session to a URL.

# `new_tab`

```elixir
@spec new_tab(Jido.Browser.Session.t(), String.t() | nil, keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Opens a new tab, optionally at a URL.

# `query`

```elixir
@spec query(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Queries a selector and returns a stable element summary.

# `reload`

```elixir
@spec reload(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Reloads the current page.

# `save_state`

```elixir
@spec save_state(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Persists browser session state to disk.

# `screenshot`

```elixir
@spec screenshot(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Captures a screenshot of the current page.

# `scroll`

```elixir
@spec scroll(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Scrolls the page, by coordinates, direction, or to a specific element.

# `select_option`

```elixir
@spec select_option(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Selects an option in a form control.

# `snapshot`

```elixir
@spec snapshot(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Returns an agent-oriented page snapshot with ref metadata when supported.

# `start_pool`

```elixir
@spec start_pool(keyword()) :: {:ok, pid()} | {:error, term()}
```

Starts a warm browser pool for adapters that support pooled sessions.

This is intended for scripts, tests, and ad hoc startup. OTP applications
should prefer adding `Jido.Browser.Pool` to their supervision tree.

# `start_session`

```elixir
@spec start_session(keyword()) :: {:ok, Jido.Browser.Session.t()} | {:error, term()}
```

Starts a browser session using the configured adapter or an explicit adapter override.

# `stop_pool`

```elixir
@spec stop_pool(term()) :: :ok | {:error, term()}
```

Stops a previously started warm browser pool.

# `switch_tab`

```elixir
@spec switch_tab(Jido.Browser.Session.t(), non_neg_integer(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Switches to a tab by index.

# `type`

```elixir
@spec type(Jido.Browser.Session.t(), String.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Types text into an element identified by a selector or agent-browser ref.

# `wait_for_navigation`

```elixir
@spec wait_for_navigation(
  Jido.Browser.Session.t(),
  keyword()
) :: {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Waits for a navigation or URL change to complete.

# `wait_for_selector`

```elixir
@spec wait_for_selector(Jido.Browser.Session.t(), String.t(), keyword()) ::
  {:ok, Jido.Browser.Session.t(), map()} | {:error, term()}
```

Waits for a selector to reach a requested state.

# `web_fetch`

```elixir
@spec web_fetch(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Fetches a URL over HTTP(S) without starting a browser session.

HTML responses keep native selector extraction and format conversion, while
fetched binary documents such as PDFs and office files are extracted through
`ExtractousEx`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
