Monday, June 3, 2024
23
rated 0 times [  29] [ 6]  / answers: 1 / hits: 25033  / 7 Years ago, tue, october 24, 2017, 12:00:00

I want to pass a custom profile to Puppeteer.
To start I've tried to pass my real Google Chrome profile:



const browser = await puppeteer.launch({
userDataDir: '/Users/[USERNAME]/Library/Application Support/Google/Chrome/Default',
headless: false,
slowMo: 250,
...
}


but when the browser opens if I go to Settings it shows Person 1 rather than the data from my Google Chrome profile



The userDataDir path above is what is shown in Profile Path when on Google Chrome I visit chrome://version (where [USERDATA] is my username)



I've tried also userDataDir: '~/Library/Application Support/Google/Chrome/Default'



I'm using

Puppeteer 0.11.0

Node 8.4.0

NPM 5.2.0

macOS El Capitan 10.11.6

MacBook Pro Retina, 15-inch, Mid 2015


More From » google-chrome

 Answers
18

Using a relative path worked. The path is relative to the folder where you are executing the cli command running the javascript that uses puppeteer:


await puppeteer.launch({
userDataDir: './myUserDataDir',
})

[#56136] Saturday, October 21, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
josefn

Total Points: 251
Total Questions: 93
Total Answers: 84

Location: Senegal
Member since Fri, Aug 21, 2020
4 Years ago
;