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

How to Intercept Selenium Traffic with Fluxzy

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

What You'll Learn

  • Configure Selenium to use Fluxzy as a proxy
  • Handle HTTPS certificates properly
  • Set up interception in Python, C#, and JavaScript
  • Debug and inspect captured traffic

Prerequisites:

  • Fluxzy Desktop or CLI installed (download here)
  • Selenium WebDriver installed in your project
  • Browser driver (ChromeDriver, GeckoDriver, etc.) installed

Two Requirements for Interception

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

  1. Proxy Configuration - Tell Selenium to route traffic through Fluxzy (default: http://127.0.0.1:44344)
  2. Certificate Handling - Configure the browser to accept Fluxzy's certificate or ignore certificate errors

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 Selenium

Selenium must be configured to route traffic through Fluxzy's proxy. Each browser has specific options for proxy configuration and certificate handling.

Python

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

# Configure proxy
chrome_options = Options()
chrome_options.add_argument('--proxy-server=http://127.0.0.1:44344')
chrome_options.add_argument('--ignore-certificate-errors')

driver = webdriver.Chrome(options=chrome_options)
driver.get('https://example.com')

# Your test code here

driver.quit()

With Firefox:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

firefox_options = Options()
firefox_options.set_preference('network.proxy.type', 1)
firefox_options.set_preference('network.proxy.http', '127.0.0.1')
firefox_options.set_preference('network.proxy.http_port', 44344)
firefox_options.set_preference('network.proxy.ssl', '127.0.0.1')
firefox_options.set_preference('network.proxy.ssl_port', 44344)
firefox_options.accept_insecure_certs = True

driver = webdriver.Firefox(options=firefox_options)
driver.get('https://example.com')

# Your test code here

driver.quit()

With pytest and fixtures:

# conftest.py
import pytest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

@pytest.fixture
def driver():
    chrome_options = Options()
    chrome_options.add_argument('--proxy-server=http://127.0.0.1:44344')
    chrome_options.add_argument('--ignore-certificate-errors')

    driver = webdriver.Chrome(options=chrome_options)
    yield driver
    driver.quit()

C# (.NET)

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

var proxy = new Proxy
{
    HttpProxy = "127.0.0.1:44344",
    SslProxy = "127.0.0.1:44344"
};

var options = new ChromeOptions();
options.Proxy = proxy;
options.AcceptInsecureCertificates = true;

using var driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://example.com");

// Your test code here

With Firefox:

using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;

var proxy = new Proxy
{
    HttpProxy = "127.0.0.1:44344",
    SslProxy = "127.0.0.1:44344"
};

var options = new FirefoxOptions();
options.Proxy = proxy;
options.AcceptInsecureCertificates = true;

using var driver = new FirefoxDriver(options);
driver.Navigate().GoToUrl("https://example.com");

// Your test code here

With NUnit:

using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

[TestFixture]
public class InterceptedTests
{
    private IWebDriver _driver;

    [SetUp]
    public void SetUp()
    {
        var proxy = new Proxy
        {
            HttpProxy = "127.0.0.1:44344",
            SslProxy = "127.0.0.1:44344"
        };

        var options = new ChromeOptions();
        options.Proxy = proxy;
        options.AcceptInsecureCertificates = true;

        _driver = new ChromeDriver(options);
    }

    [TearDown]
    public void TearDown()
    {
        _driver?.Quit();
    }

    [Test]
    public void TestWithInterception()
    {
        _driver.Navigate().GoToUrl("https://example.com");
        // Your test assertions here
    }
}

JavaScript (Node.js)

const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');

const options = new chrome.Options();
options.addArguments('--proxy-server=http://127.0.0.1:44344');
options.addArguments('--ignore-certificate-errors');

const driver = await new Builder()
    .forBrowser('chrome')
    .setChromeOptions(options)
    .build();

await driver.get('https://example.com');

// Your test code here

await driver.quit();

With Firefox:

const { Builder } = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');
const { Capabilities } = require('selenium-webdriver');

const caps = new Capabilities();
caps.setAcceptInsecureCerts(true);

const options = new firefox.Options();
options.setPreference('network.proxy.type', 1);
options.setPreference('network.proxy.http', '127.0.0.1');
options.setPreference('network.proxy.http_port', 44344);
options.setPreference('network.proxy.ssl', '127.0.0.1');
options.setPreference('network.proxy.ssl_port', 44344);

const driver = await new Builder()
    .forBrowser('firefox')
    .setFirefoxOptions(options)
    .withCapabilities(caps)
    .build();

await driver.get('https://example.com');

// Your test code here

await driver.quit();

With Mocha:

const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const { expect } = require('chai');

describe('Intercepted Tests', function() {
    let driver;

    beforeEach(async function() {
        const options = new chrome.Options();
        options.addArguments('--proxy-server=http://127.0.0.1:44344');
        options.addArguments('--ignore-certificate-errors');

        driver = await new Builder()
            .forBrowser('chrome')
            .setChromeOptions(options)
            .build();
    });

    afterEach(async function() {
        if (driver) {
            await driver.quit();
        }
    });

    it('should intercept traffic', async function() {
        await driver.get('https://example.com');
        // Your test assertions here
    });
});

Quick Reference

Language Proxy Setting Certificate Handling
Python (Chrome) --proxy-server=http://127.0.0.1:44344 --ignore-certificate-errors
Python (Firefox) network.proxy.* preferences accept_insecure_certs = True
C# Proxy.HttpProxy, Proxy.SslProxy AcceptInsecureCertificates = true
JavaScript (Chrome) --proxy-server=http://127.0.0.1:44344 --ignore-certificate-errors

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 both HTTP and SSL proxy are configured (required for HTTPS)
  4. Try with http:// site first to verify basic connectivity

Certificate Errors Despite Configuration

Symptoms: SSL errors even with certificate options set.

Solutions:

  1. For Chrome, ensure --ignore-certificate-errors is in the arguments
  2. For Firefox, verify accept_insecure_certs is set to True
  3. Some sites with certificate pinning may still fail - this is expected
  4. Make sure SSL proxy is configured, not just HTTP proxy

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

WebDriver Cannot Start

Symptoms: Browser fails to launch with proxy settings.

Solutions:

  1. Verify browser driver version matches browser version
  2. Check that proxy arguments are formatted correctly
  3. Ensure no conflicting browser options are set
  4. Try with a fresh browser profile

Different Behavior Across Browsers

Symptoms: Interception works in Chrome but not Firefox (or vice versa).

Solutions:

  1. Each browser has different proxy configuration methods - use the correct one
  2. Firefox requires explicit preferences, Chrome uses command-line arguments
  3. Ensure AcceptInsecureCerts is set appropriately for each browser

Next Steps

ESC