Skip to content

openBrowser()

Launches a browser with a tab. The browser will be closed when the parent node.js process is closed.
Note : openBrowser launches the browser in headless mode by default, but when openBrowser is called from repl it launches the browser in headful mode.

await openBrowser({headless: false})
await openBrowser()
await openBrowser({args:['--window-size=1440,900']})
await openBrowser({args: [
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-first-run',
'--no-sandbox',
'--no-zygote']}) # These are recommended args that has to be passed when running in docker
NameTypeDescription
optionsObjecteg. {headless: true|false, args:[‘—window-size=1440,900’]} Default: {headless:true}.
options.headlessbooleanOption to open browser in headless/headful mode. Default: true.
options.argsArrayChromium browser launch options. Default: [].
options.hoststringRemote host to connect to. Default: '127.0.0.1'.
options.targetstringDetermines which target the client should interact.(https://github.com/cyrus-and/chrome-remote-interface#cdpoptions-callback)
options.portnumberRemote debugging port, if not given connects to any open port. Default: 0.
options.useHostNamenumberIf the browser should be called using the hostname itself or with IP address Default: false.
options.securenumberHTTPS/WSS frontend. Defaults to false. Default: false.
options.ignoreCertificateErrorsbooleanOption to ignore certificate errors. Default: true.
options.observebooleanOption to run each command after a delay. Useful to observe what is happening in the browser. Default: false.
options.observeTimenumberOption to modify delay time for observe mode. Accepts value in milliseconds. Default: 3000.
options.dumpiobooleanOption to dump IO from browser. Default: false.
TypeDescription
Promise<void>