Skip to content

Latest commit

 

History

History

xrom

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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 })