Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

feat(puppeteer): Add User Data Dir puppeteer option #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ module.exports = {
Mobile: '320x568'
},
puppeteerArgs: '--no-sandbox --disable-setuid-sandbox',
puppeteerExecutablePath: 'google-chrome-unstable'
puppeteerExecutablePath: 'google-chrome-unstable',
pupperteerUserDataDir: '/home/corn/.config/google-chrome/Default' // https://github.com/GoogleChrome/puppeteer/blob/v1.18.1/docs/api.md#puppeteerdefaultargsoptions
};
```

Expand Down
7 changes: 6 additions & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ require('yargs')
type: 'string',
describe: 'Path to a Chromium executable to use instead of the one downloaded by Puppeteer.'
},
'puppeteer-user-data-dir': {
type: 'string',
describe: 'Path to a Chromium User Data directory to use instead of the blank temporary one used by Puppeteer.'
},
'puppeteer-wait-until': {
type: 'string',
describe: 'The Puppeteer navigation event to use before considering the page loaded.',
Expand All @@ -99,7 +103,8 @@ require('yargs')
const launchArgs = {
args: argv.puppeteerArgs ? argv.puppeteerArgs.split(' ') : [],
executablePath: argv.puppeteerExecutablePath,
headless: !debug
headless: !debug,
userDataDir: argv.puppeteerUserDataDir
};

const browser = await puppeteer.launch(launchArgs);
Expand Down