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

Commit deb8d40

Browse files
gorangajicfelixfbecker
authored andcommitted
feat: add chromeFlags, chromePath and --headless as default
Fixes #146 pdf only works in headless mode Fixes #184 Add chromePath and chromeFlags to ChromelessOptions
1 parent fcdc8dc commit deb8d40

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default class Chromeless<T extends any> implements Promise<T> {
4646
closeTab: true,
4747
...options.cdp,
4848
},
49+
chromeFlags: ['--headless'],
4950
}
5051

5152
const chrome = mergedOptions.remote

src/chrome/local.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ export default class LocalChrome implements Chrome {
3838
const { port } = this.options.cdp
3939
this.chromeInstance = await launch({
4040
logLevel: this.options.debug ? 'info' : 'silent',
41-
port,
41+
port: this.options.cdp.port,
42+
chromeFlags: this.options.chromeFlags,
43+
chromePath: this.options.chromePath,
4244
})
4345
const target = await CDP.New({
4446
port,

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export interface ChromelessOptions {
5353
launchChrome?: boolean // auto-launch chrome (local) `true`
5454
cdp?: CDPOptions
5555
remote?: RemoteOptions | boolean
56+
chromeFlags?: Array<string> // ['--headless']
57+
chromePath?: string
5658
}
5759

5860
export interface Chrome {

0 commit comments

Comments
 (0)