
cache directory of your project directory and figure out the full path.Īdd the executablePath: of the Chrome executable to your script: const browser = await puppeteer. You can find the list on the Troubleshooting page.įind Chrome inside the. On Unix, make sure all the necessary dependencies are installed. Here you can basically hit enter until the init is done. The first time you run the above code, you will have to comment out the fs.readFile to fs.writeFile as the UserDirDirectory is created if it does not exist the first time that Chrome is started. Now Chrome will be stored inside the project directory in the. Essentially, Puppeteer creates a custom profile each time it runs, we can override that profile and define the download directory. Download the Node.js source code or a pre-built installer for your platform, and start developing today. This will change the default location of Chrome to your project directory. Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Changes the cache location for Puppeteer.ĬacheDirectory: join(_dirname, '.cache', 'puppeteer'), For a version of Puppeteer purely for connection, see puppeteer-core.

You can tap into this event and physically download the contents into a file. The 3rd point in Amr Hussein's answer helped me to solve a similar Problem where I got the following error, whenever I executed my script outside the project directory: throw new Error(`Could not find Chromium (rev. When you install Puppeteer, it downloads a recent version of Chromium (170MB Mac, 282MB Linux, 280MB Win) that is guaranteed to work with the API (customizable through Environment Variables). To download Microsoft Edge, go to Download Microsoft Edge Insider Channels. This page downloads a csv by creating a comma delimited string and forcing the browser to download it by setting the data type like so let uri 'data:text/csv charsetutf-8,' + encodeURIComponent (content) window.open (uri, 'Some CSV') This on chrome opens a new tab.
