Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 893 Bytes

readme.md

File metadata and controls

41 lines (32 loc) · 893 Bytes

xrom npm

Run dockerized Chromium or Firefox in headless remote debugging mode and return browserWSEndpoint needed for puppeteer.connect().

Install

$ yarn add xrom

Usage

type TRunBrowserOptions = {
  browser: 'chromium' | 'firefox',
  version: string,
  port?: number,
  fontsDir?: string,
  mountVolumes?: {
    from: string,
    to: string,
  }[],
  cpus?: number,
  cpusetCpus?: number[]
}

type TRunBrowserResult = {
  browserWSEndpoint: string,
  closeBrowser: () => Promise<void>,
}

runBrowser(options: TRunBrowserOptions) => Promise<TRunBrowserResult>
import { runBrowser } from 'xrom'
import puppeteer from 'puppeteer-core'

const { browserWSEndpoint } = await runBrowser({ browser: 'chromium' })
const browser = await puppeteer.connect({ browserWSEndpoint })