Skip to content

About

Chrome extension for managing HTTP/S and SOCKS proxy. Made for use with Selenium

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Proxy Chrome extension for Selenium

This is a Chrome extension that lets you configure, enable, and disable HTTP/HTTPS/SOCKS5 proxies on the fly. You can use its built-in UI or drive it programmatically via a simple postMessage API. The badge icon reflects the current proxy status.


This extension is also available from Chrome Web Store


Features

  • UI popup for entering proxy settings (scheme, host, port, credentials)
  • Enable or disable proxy from the popup
  • Badge indicator shows “ON” or “OFF” with color coding
  • External API via window.postMessage for script-driven control
  • Persistent storage of last used proxy configuration

Installation

  • Clone or download this repository to a local folder.
  • Open Chrome and navigate to chrome://extensions.
  • Enable Developer mode in the top right.
  • Click Load unpacked and select the extension folder.
  • The extension icon will appear in your toolbar.

Usage

Manual (UI)

  • Click the extension icon in the toolbar.
  • In the popup, select the scheme (http/https/socks5).
  • Enter the proxy host, port, and optional username/password.
  • Click Зберегти та Увімкнути to apply the proxy.
  • Click Вимкнути Проксі to revert to a direct connection.
  • The badge will display ON (green) or OFF (red) reflecting the current state.

Script (Python + Selenium)

Use Selenium’s execute_script or execute_async_script to send commands without opening the UI.

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--load-extension=/path/to/extension")
driver = webdriver.Chrome(options=options)
driver.get("about:blank")

Set proxy:

driver.execute_script("""
    window.postMessage({
        direction: "toExtension",
        msg: {
            action: "setProxy",
            config: {
                scheme:   "http",
                host:     "123.45.67.89",
                port:      8080,
                username: "user",
                password: "pass"
            }
        }
    }, "*");
""")

Enable proxy:

driver.execute_script("""
    window.postMessage({
        direction: "toExtension",
        msg: { action: "enableProxy" }
    }, "*");
""")

Disable proxy:

driver.execute_script("""
    window.postMessage({
        direction: "toExtension",
        msg: { action: "disableProxy" }
    }, "*");
""")

Note - enabling or disabling proxy without setting them first will have no result

Check proxy status (returns True or False):

status = driver.execute_async_script("""
    const callback = arguments[0];
    window.addEventListener("message", function handler(e) {
        if (e.data.direction === "fromExtension") {
            window.removeEventListener("message", handler);
            callback(e.data.response.enabled);
        }
    });
    window.postMessage({ direction: "toExtension", msg: { action: "getStatus" } }, "*");
""")

Detailed usage examples can be seen in usage.py


File Structure

  • manifest.json – extension metadata and permissions
  • ui/settings.html – UI markup
  • scripts/settings.js – UI logic and event handlers
  • scripts/background.js – proxy settings, badge updates, message handling
  • scripts/content-script.js – bridges page scripts and background

License and Contributions

This code is provided free of charge and may be used without restriction. Any suggestions, improvements, or bug reports are welcome via pull requests or issues in this repository.


This README was generated by Microsoft Copilot and may contain minor inaccuracies.

About

Chrome extension for managing HTTP/S and SOCKS proxy. Made for use with Selenium

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages