# `Playwriter.Transport.Behaviour`
[🔗](https://github.com/nshkrdotcom/playwriter/blob/v0.1.0/lib/playwriter/transport/behaviour.ex#L1)

Behaviour defining the transport interface for Playwright communication.

Transports abstract how Playwriter communicates with Playwright:
- `Playwriter.Transport.Local` - Uses playwright_ex with Erlang Ports
- `Playwriter.Transport.Remote` - Uses WebSocket to remote Playwright server

# `browser_type`

```elixir
@type browser_type() :: :chromium | :firefox | :webkit
```

# `guid`

```elixir
@type guid() :: String.t()
```

# `message`

```elixir
@type message() :: map()
```

# `result`

```elixir
@type result() :: {:ok, map()} | {:error, term()}
```

# `transport`

```elixir
@type transport() :: pid() | GenServer.server()
```

# `click`

```elixir
@callback click(transport(), guid(), String.t(), keyword()) :: :ok | {:error, term()}
```

Click an element

# `close_browser`

```elixir
@callback close_browser(transport(), guid()) :: :ok | {:error, term()}
```

Close a browser

# `close_context`

```elixir
@callback close_context(transport(), guid()) :: :ok | {:error, term()}
```

Close a context

# `close_page`

```elixir
@callback close_page(transport(), guid()) :: :ok | {:error, term()}
```

Close a page

# `content`

```elixir
@callback content(transport(), guid()) :: {:ok, String.t()} | {:error, term()}
```

Get page content

# `fill`

```elixir
@callback fill(transport(), guid(), String.t(), String.t(), keyword()) ::
  :ok | {:error, term()}
```

Fill an input

# `goto`

```elixir
@callback goto(transport(), guid(), String.t(), keyword()) :: result()
```

Navigate to a URL

# `healthy?`

```elixir
@callback healthy?(transport()) :: boolean()
```

Check if transport is healthy

# `launch_browser`

```elixir
@callback launch_browser(transport(), browser_type(), keyword()) ::
  {:ok, guid()} | {:error, term()}
```

Launch a browser instance

# `new_context`

```elixir
@callback new_context(transport(), guid(), keyword()) :: {:ok, guid()} | {:error, term()}
```

Create a new browser context

# `new_page`

```elixir
@callback new_page(transport(), guid()) :: {:ok, map()} | {:error, term()}
```

Create a new page in a context

# `screenshot`

```elixir
@callback screenshot(transport(), guid(), keyword()) :: {:ok, binary()} | {:error, term()}
```

Take a screenshot

# `send_message`

```elixir
@callback send_message(transport(), message(), timeout()) :: result()
```

Send a message to Playwright and wait for response

# `start_link`

```elixir
@callback start_link(keyword()) :: {:ok, pid()} | {:error, term()}
```

Start the transport connection

# `stop`

```elixir
@callback stop(transport()) :: :ok
```

Stop the transport

---

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