Skip to content

A proof-of-concept implementation showing how to use the Camoufox automation framework with Node.js. This repository serves as an example of integrating Camoufox's Python-based automation capabilities into Node.js applications.

Notifications You must be signed in to change notification settings

DemonMartin/node-camoufox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-camoufox

A proof-of-concept implementation showing how to use the Camoufox automation framework with Node.js. This repository serves as an example of integrating Camoufox's Python-based automation capabilities into Node.js applications.

MIT License Powered by Camoufox

Important Notes

  • This is not an NPM package - it's an example implementation
  • For the latest features and options, always refer to the official Camoufox documentation
  • This implementation can be freely used as a starting point for your own projects

Prerequisites

  1. Python 3.8 or higher
  2. Node.js 16.0 or higher
  3. Camoufox Python package with GeoIP support (recommended):
pip install -U camoufox[geoip]
  1. Camoufox browser:
camoufox fetch

Quick Start

# Clone this example
git clone https://github.com/DemonMartin/node-camoufox.git
cd node-camoufox

# Install Playwright
npm install

Basic Usage

import { firefox } from 'playwright';
import { CamoufoxServer } from './src/CamoufoxServer.js';

async function example() {
    const server = new CamoufoxServer({
        headless: false,
        humanize: true,
        debug: true
    });

    try {
        const wsEndpoint = await server.start();
        const browser = await firefox.connect(wsEndpoint);
        server.setBrowser(browser);

        const page = await browser.newPage();
        await page.goto('https://example.com');
        
        // Your automation code here...
        
    } finally {
        await server.stop();
    }
}

Basic Configuration

const server = new CamoufoxServer({
    headless: true,    // Run in headless mode
    humanize: true,    // Enable humanization
    debug: false,      // Debug logging
    proxy: {          // Optional proxy
        server: 'http://proxy.example.com:8080',
        username: 'user',
        password: 'pass'
    }
});

Extended Configuration

For additional configuration options and features, please check:

This implementation doesnt support all Camoufox options - you can extend the configuration based on the official documentation by yourself. You need to update and edit CamoufoxServer.js and server.py yourself.

Debugging

Enable debug logging to see detailed operation information:

const server = new CamoufoxServer({
    debug: true,
    // other options...
});

Debug messages follow this format:

[2025-01-28T20:29:17.445Z] Starting server...
[2025-01-28T20:29:21.078Z] Connecting to browser...
[2025-01-28T20:29:24.049Z] Page loaded

Contributing

Feel free to:

  • Fork and modify for your needs
  • Open issues for bugs
  • Suggest improvements
  • Share your use cases
  • Open pull requests

License

MIT - Feel free to use and modify

Credits

Disclaimer

This is a community example showing how to use Camoufox with Node.js. It is not an official package or module. For production use, ensure you understand the Camoufox framework and adapt this implementation to your needs.

About

A proof-of-concept implementation showing how to use the Camoufox automation framework with Node.js. This repository serves as an example of integrating Camoufox's Python-based automation capabilities into Node.js applications.

Topics

Resources

Stars

Watchers

Forks