Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Commit

Permalink
feat: add chromeFlags, chromePath and --headless as default
Browse files Browse the repository at this point in the history
Fixes #146 pdf only works in headless mode
Fixes #184 Add chromePath and chromeFlags to ChromelessOptions
  • Loading branch information
gorangajic authored and felixfbecker committed Jan 18, 2018
1 parent fcdc8dc commit deb8d40
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default class Chromeless<T extends any> implements Promise<T> {
closeTab: true,
...options.cdp,
},
chromeFlags: ['--headless'],
}

const chrome = mergedOptions.remote
Expand Down
4 changes: 3 additions & 1 deletion src/chrome/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export default class LocalChrome implements Chrome {
const { port } = this.options.cdp
this.chromeInstance = await launch({
logLevel: this.options.debug ? 'info' : 'silent',
port,
port: this.options.cdp.port,
chromeFlags: this.options.chromeFlags,
chromePath: this.options.chromePath,
})
const target = await CDP.New({
port,
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export interface ChromelessOptions {
launchChrome?: boolean // auto-launch chrome (local) `true`
cdp?: CDPOptions
remote?: RemoteOptions | boolean
chromeFlags?: Array<string> // ['--headless']
chromePath?: string
}

export interface Chrome {
Expand Down

0 comments on commit deb8d40

Please sign in to comment.