Skip to content

Commit

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

const chrome = mergedOptions.remote
Expand Down
2 changes: 2 additions & 0 deletions src/chrome/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export default class LocalChrome implements Chrome {
this.chromeInstance = await launch({
logLevel: this.options.debug ? 'info' : 'silent',
port: this.options.cdp.port,
chromeFlags: this.options.chromeFlags,
chromePath: this.options.chromePath,
})
const target = await CDP.New({
port: this.chromeInstance.port,
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,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 d9cfea6

Please sign in to comment.