Skip to content

Instantly share code, notes, and snippets.

@VikashLoomba
Created October 2, 2024 05:48
Show Gist options
  • Select an option

  • Save VikashLoomba/18aff2fead43a0fd319defbd6066c16b to your computer and use it in GitHub Desktop.

Select an option

Save VikashLoomba/18aff2fead43a0fd319defbd6066c16b to your computer and use it in GitHub Desktop.
Launch a custom firefox browser binary (camoufox) with Playwright
import { firefox } from 'playwright';
const config = {
'window.history.length': 4,
'navigator.language': 'en-US',
'navigator.languages': ['en-US'],
};
const browserServer = await firefox.launchServer({
headless: false,
args: ['--config', JSON.stringify(config)],
port: 9222,
// Path to the camoufox launch binary from a camoufox release
executablePath: '/camoufox/launch',
wsPath: '/session'
});
const wsEndpoint = browserServer.wsEndpoint();
console.log(wsEndpoint);
// Use web socket endpoint later to establish a connection.
browserServer.on('close', () => {
console.log('Browser server closed');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment