Playwriter.WindowsBrowserAdapter (Playwriter v0.0.2)

View Source

Adapter for connecting to Windows browsers from WSL using Playwright's WebSocket transport.

This module provides utilities to:

  1. Automatically start a Playwright server on Windows if needed
  2. Connect to it from WSL
  3. Use Windows Chrome/Firefox browsers from your Elixir app in WSL

No manual setup required - everything is handled automatically!

Summary

Functions

Connects to a Windows browser via WebSocket.

Enhanced fetch function that uses Windows browsers.

Lists available Chrome profiles on Windows.

Gets the Windows host IP address from WSL.

Starts a Playwright server on Windows and returns the WebSocket endpoint.

Functions

connect_windows_browser(browser_type \\ :chromium, opts \\ %{})

Connects to a Windows browser via WebSocket.

Examples

# Connect to Chrome on Windows
{:ok, browser} = Playwriter.WindowsBrowserAdapter.connect_windows_browser(:chromium)

# Connect to Firefox on Windows
{:ok, browser} = Playwriter.WindowsBrowserAdapter.connect_windows_browser(:firefox)

fetch_with_windows_browser(url, opts \\ %{})

Enhanced fetch function that uses Windows browsers.

get_chrome_profiles()

Lists available Chrome profiles on Windows.

get_windows_host_ip()

Gets the Windows host IP address from WSL.

start_windows_playwright_server(opts \\ %{})

Starts a Playwright server on Windows and returns the WebSocket endpoint.

This uses PowerShell to execute commands on the Windows side.