Skip to content

Commit e5eb59d

Browse files
committed
allow args to be passed to custom browser
1 parent 709e1b4 commit e5eb59d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ InvalidUrlError.prototype = Error.prototype
99

1010
module.exports = async (
1111
url,
12-
{debug = false, waitUntil = 'networkidle2', customBrowser = {}} = {}
12+
{debug = false, waitUntil = 'networkidle2', customBrowser = null} = {}
1313
) => {
1414
const browserOptions = {
1515
headless: debug !== true,
@@ -22,10 +22,12 @@ module.exports = async (
2222
if (
2323
customBrowser &&
2424
customBrowser.executablePath &&
25-
customBrowser.customPuppeteer
25+
customBrowser.customPuppeteer &&
26+
customBrowser.args
2627
) {
2728
browserOptions.executablePath = customBrowser.executablePath
28-
browserOptions.puppeteer = customBrowser.customPuppeteer
29+
browserOptions.puppeteer = customBrowser.puppeteer
30+
browserOptions.args = customBrowser.args
2931
}
3032

3133
// Setup a browser instance

test/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ test('it accepts a custom Chrome and Puppeteer version for use on AWS', async t
129129
const actual = await extractCss(server.url + path, {
130130
customBrowser: {
131131
executablePath: chromium.path,
132-
customPuppeteer: puppeteerCore
132+
puppeteer: puppeteerCore,
133+
args: chromium.args
133134
}
134135
})
135136

0 commit comments

Comments
 (0)