Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@freestyle-sh/with-playwright

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@freestyle-sh/with-playwright

Playwright runtime for [Freestyle](https://freestyle.sh) VMs, including browser installs.

latest
npmnpm
Version
0.2.11
Version published
Maintainers
2
Created
Source

@freestyle-sh/with-playwright

Playwright runtime for Freestyle VMs, including browser installs.

Installation

npm install @freestyle-sh/with-playwright freestyle

Usage

import { freestyle } from "freestyle";
import { VmPlaywright } from "@freestyle-sh/with-playwright";

const { vm } = await freestyle.vms.create({
  with: {
    playwright: new VmPlaywright(),
  },
});

const res = await vm.playwright.runCode({
  code: `
  const { chromium } = require("playwright");
  (async () => {
    const browser = await chromium.launch();
    const page = await browser.newPage();
    await page.goto("https://example.com");
    const title = await page.title();
    await browser.close();
    console.log(JSON.stringify({ title }));
  })();
  `,
});

console.log(res);

Options

new VmPlaywright({
  nodeVersion: "24",
  playwrightVersion: "1.47.0",
  installDeps: true,
  browsers: ["chromium"],
})
OptionTypeDefaultDescription
nodeVersionstring"24"Node.js version to install via NVM.
playwrightVersionstringundefinedPlaywright version to install.
installDepsbooleantrueInstall Playwright system dependencies via --with-deps.
browsers("chromium" | "firefox" | "webkit")[]undefinedLimit browser installs; default installs all.

API

vm.playwright.runCode({ code: string })

Executes JavaScript code in the Playwright-ready Node.js runtime.

Returns: Promise<RunCodeResponse>

type RunCodeResponse<Result> = {
  result: Result;
  stdout?: string;
  stderr?: string;
  statusCode?: number;
};

vm.playwright.install(options?)

Installs npm packages with npm install.

await vm.playwright.install({ deps: ["@playwright/test"] });

Returns: Promise<InstallResult>

type InstallResult = {
  success: boolean;
  stdout?: string;
  stderr?: string;
};

Documentation

FAQs

Package last updated on 21 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts