@@ -107,21 +107,21 @@ func (c *BrowserRunConnector) Execute(ctx context.Context, params map[string]any
107107 case "javascript" :
108108 containerImage = playwrightNodeImage
109109 wrapperScript = buildJSWrapper (script )
110- // The Playwright Docker image has browsers + a global playwright install.
111- // Set NODE_PATH so `require('playwright')` finds the global package when
112- // running a script from stdin.
113- containerCmd = []string {"sh" , "-c" , "NODE_PATH=$( npm root -g) node" }
110+ // The official Playwright Docker image ships browsers and system deps but
111+ // NOT the npm package. Install it (pinned to match the image version) then
112+ // run the wrapper from stdin.
113+ containerCmd = []string {"sh" , "-c" , "npm install --no-save --silent playwright 2>/dev/null && node" }
114114 case "typescript" :
115115 containerImage = playwrightNodeImage
116116 wrapperScript = buildJSWrapper (script )
117117 // Same as JS but with TypeScript type-stripping enabled.
118- containerCmd = []string {"sh" , "-c" , "NODE_PATH=$( npm root -g) node --experimental-strip-types" }
118+ containerCmd = []string {"sh" , "-c" , "npm install --no-save --silent playwright 2>/dev/null && node --experimental-strip-types" }
119119 case "python" :
120120 containerImage = playwrightPythonImage
121121 wrapperScript = buildPythonWrapper (script )
122- // The Playwright Python image has playwright pre-installed globally.
123- // Read the script from stdin.
124- containerCmd = []string {"python3 " , "-" }
122+ // The official Playwright Python image ships browsers and system deps but
123+ // NOT the pip package. Install it then run the wrapper from stdin.
124+ containerCmd = []string {"sh " , "-c" , "pip install --quiet playwright 2>/dev/null && python3 -" }
125125 }
126126
127127 // --- build docker/run params ---
0 commit comments