Skip to content

Latest commit

 

History

History
99 lines (70 loc) · 2.46 KB

README.md

File metadata and controls

99 lines (70 loc) · 2.46 KB

airtap-electron

Electron browser provider.

npm status node Travis build status JavaScript Style Guide

Table of Contents

Click to expand

Usage

Programmatic

const Electron = require('airtap-electron')
const provider = new Electron()

// Get a list of desired browsers (there's just 1 here)
const wanted = [{ name: 'electron' }]
const manifests = await provider.manifests(wanted)

// Instantiate a browser
const target = { url: 'http://localhost:3000' }
const browser = provider.browser(manifests[0], target)

await browser.open()

With Airtap

providers:
  - airtap-electron

browsers:
  - name: electron

This provider also exposes a supports property to match on:

browsers:
  - name: electron
    supports:
      headless: true

API

Electron()

Constructor. Returns an instance of browser-provider.

Browser options

  • headless (boolean, default true): run in headless mode
  • window (object): custom options to pass to BrowserWindow()
  • devtools (object): custom options to pass to openDevTools() (unless headless)

In Airtap these can be set like so:

browsers:
  - name: electron
    options:
      headless: false
      window:
        webPreferences:
          sandbox: true
      devtools:
        mode: detach

Install

Electron must be installed separately. With npm do:

npm install airtap-electron electron

License

MIT © 2020-present Airtap contributors