From ac878aed48ecb10450cb10bcae624ea5cd122eda Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Mon, 11 Aug 2025 12:02:52 +0400 Subject: [PATCH] refactor: pass custom executable path --- nodecar/src/camoufox-worker.ts | 9 +++++++++ nodecar/src/index.ts | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/nodecar/src/camoufox-worker.ts b/nodecar/src/camoufox-worker.ts index d7de5ea..eb723cf 100644 --- a/nodecar/src/camoufox-worker.ts +++ b/nodecar/src/camoufox-worker.ts @@ -158,6 +158,15 @@ export async function runCamoufoxWorker(id: string): Promise { env: finalEnv, }; + // If a custom executable path was provided, ensure Playwright uses it + if ( + (camoufoxOptions as any).executable_path && + typeof (camoufoxOptions as any).executable_path === "string" + ) { + finalOptions.executablePath = (camoufoxOptions as any) + .executable_path as string; + } + // Only add proxy if it exists and is valid if (camoufoxOptions.proxy) { try { diff --git a/nodecar/src/index.ts b/nodecar/src/index.ts index 0facc98..9f56422 100644 --- a/nodecar/src/index.ts +++ b/nodecar/src/index.ts @@ -243,6 +243,16 @@ program ",", ) as "UBO"[]; + // Executable path: forward through to camoufox-js and ultimately Playwright + if ( + options.executablePath && + typeof options.executablePath === "string" + ) { + // camoufox-js uses snake_case for this option + (camoufoxOptions as any).executable_path = + options.executablePath as string; + } + // Screen and window const screen: { minWidth?: number;