How to run Puppeteer with existing Chrome profile

Nut Janekitiworapong
Nut .
Published in
1 min readJul 21, 2020
Photo by Sandy Millar on Unsplash

Oftentimes you need to run puppeteer (github.com/puppeteer/puppeteer) by using your existing chrome profile. My use case is that I need to automate my Chrome browser by using my corp profile.

The good thing is puppeteer allows you to specify an id of webSocketDebuggerUrl.

What you need to do is (1) Start new chrome windows with remote-debugging flag so that you can get webSocketDebuggerUrl.

For Linux, run this command:

For Mac, run this command:

You should get new Chrome window and some logs from Terminal.

(2) Then in your puppeteer js file, copy websocket url (ws) from Terminal and put in your js file. See example below:

--

--