Electron browser provider.
Click to expand
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
Constructor. Returns an instance of browser-provider
.
headless
(boolean, default true): run in headless modewindow
(object): custom options to pass toBrowserWindow()
devtools
(object): custom options to pass toopenDevTools()
(unlessheadless
)
In Airtap these can be set like so:
browsers:
- name: electron
options:
headless: false
window:
webPreferences:
sandbox: true
devtools:
mode: detach
Electron must be installed separately. With npm do:
npm install airtap-electron electron
MIT © 2020-present Airtap contributors