New Fluxzy 2.0 just shipped. Electron is out, Tauri is in. Fresh design, 68% smaller install. Learn more

How to Intercept Playwright Traffic with Fluxzy

Intercepting traffic from Playwright tests lets you debug API calls, verify request payloads, analyze performance, and troubleshoot authentication issues. This guide shows you how to configure Playwright to route traffic through Fluxzy.

What You'll Learn

  • Configure Playwright to use Fluxzy as a proxy
  • Handle HTTPS certificates properly
  • Set up interception in Python, Node.js, and .NET
  • Debug and inspect captured traffic

Prerequisites:

  • Fluxzy Desktop or CLI installed (download here)
  • Playwright installed in your project

Two Requirements for Interception

To intercept HTTPS traffic from Playwright, you must satisfy two conditions:

  1. Proxy Configuration - Tell Playwright to route traffic through Fluxzy (default: http://127.0.0.1:44344)
  2. Certificate Handling - Set ignoreHTTPSErrors: true on the browser context

Start Fluxzy

Before running your tests, start Fluxzy to listen for connections.

Using Fluxzy Desktop:

  1. Open Fluxzy Desktop
  2. Click Start Capture (or press F5)
  3. Default proxy address: 127.0.0.1:44344

Using Fluxzy CLI:

fluxzy start -l 127.0.0.1:44344

Configure Playwright

Playwright must be configured to route traffic through Fluxzy's proxy and to accept Fluxzy's certificate. The ignoreHTTPSErrors option tells the browser to skip certificate validation, allowing Fluxzy to intercept HTTPS traffic.

Node.js (TypeScript/JavaScript)

import { chromium } from 'playwright';

const browser = await chromium.launch({
  proxy: {
    server: 'http://127.0.0.1:44344'
  }
});

const context = await browser.newContext({
  ignoreHTTPSErrors: true
});

const page = await context.newPage();
await page.goto('https://example.com');

// Your test code here

await browser.close();

With Playwright Test:

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    proxy: {
      server: 'http://127.0.0.1:44344'
    },
    ignoreHTTPSErrors: true
  }
});

Python

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(
        proxy={
            "server": "http://127.0.0.1:44344"
        }
    )

    context = browser.new_context(
        ignore_https_errors=True
    )

    page = context.new_page()
    page.goto("https://example.com")

    # Your test code here

    browser.close()

With pytest-playwright:

# conftest.py
import pytest

@pytest.fixture(scope="session")
def browser_context_args(browser_context_args):
    return {
        **browser_context_args,
        "ignore_https_errors": True
    }

@pytest.fixture(scope="session")
def browser_type_launch_args(browser_type_launch_args):
    return {
        **browser_type_launch_args,
        "proxy": {
            "server": "http://127.0.0.1:44344"
        }
    }

.NET (C#)

using Microsoft.Playwright;

var playwright = await Playwright.CreateAsync();

var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
{
    Proxy = new Proxy
    {
        Server = "http://127.0.0.1:44344"
    }
});

var context = await browser.NewContextAsync(new BrowserNewContextOptions
{
    IgnoreHTTPSErrors = true
});

var page = await context.NewPageAsync();
await page.GotoAsync("https://example.com");

// Your test code here

await browser.CloseAsync();

With NUnit/MSTest:

using Microsoft.Playwright;
using Microsoft.Playwright.NUnit;

public class InterceptedTests : PageTest
{
    public override BrowserNewContextOptions ContextOptions()
    {
        return new BrowserNewContextOptions
        {
            IgnoreHTTPSErrors = true
        };
    }

    [SetUp]
    public async Task SetUp()
    {
        // Configure proxy at browser level
        await Context.Browser.NewContextAsync(new BrowserNewContextOptions
        {
            IgnoreHTTPSErrors = true
        });
    }
}

Quick Reference

Language Proxy Setting Certificate Handling
Node.js proxy: { server: 'http://127.0.0.1:44344' } ignoreHTTPSErrors: true
Python proxy={"server": "http://127.0.0.1:44344"} ignore_https_errors=True
.NET Proxy = new Proxy { Server = "..." } IgnoreHTTPSErrors = true

Troubleshooting

No Traffic in Fluxzy

Symptoms: Tests run but Fluxzy shows no exchanges.

Solutions:

  1. Verify Fluxzy is running and listening on the correct port
  2. Check proxy URL matches Fluxzy's listen address
  3. Ensure no firewall blocking localhost connections
  4. Try with http:// site first to verify basic connectivity

Certificate Errors Despite ignoreHTTPSErrors

Symptoms: SSL errors even with ignoreHTTPSErrors: true.

Solutions:

  1. Ensure ignoreHTTPSErrors is set on the context, not just browser
  2. For Chromium, verify the option is passed correctly
  3. Some sites with certificate pinning may still fail - this is expected

Tests Timeout When Proxy Is Set

Symptoms: Tests hang or timeout after adding proxy configuration.

Solutions:

  1. Verify Fluxzy is running before tests start
  2. Check proxy server address is correct (no typos)
  3. Ensure Fluxzy isn't blocked by firewall or security software
  4. Try increasing test timeout temporarily to diagnose

Different Behavior in Headed vs Headless

Symptoms: Interception works in headed mode but not headless.

Solutions:

  1. Explicitly set proxy in launch options (not just environment variables)
  2. Some browser configurations differ - ensure consistent setup
  3. Check if any browser args are overriding proxy settings

Next Steps

ESC