puppeteer/assets/js/167768a9.67e30a49.js

2 lines
12 KiB
JavaScript
Raw Normal View History

/*! For license information please see 167768a9.67e30a49.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7883],{61970:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>h,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var n=t(85893),a=t(11151),o=t(23277),l=t(64757);const s={},i="Installation",u={id:"guides/installation",title:"Installation",description:"To use Puppeteer in your project, run:",source:"@site/versioned_docs/version-22.8.1/guides/installation.md",sourceDirName:"guides",slug:"/guides/installation",permalink:"/guides/installation",draft:!1,unlisted:!1,tags:[],version:"22.8.1",frontMatter:{},sidebar:"docs",previous:{title:"What is Puppeteer?",permalink:"/guides/what-is-puppeteer"},next:{title:"Getting started",permalink:"/guides/getting-started"}},c={},p=[];function d(e){const r={a:"a",code:"code",em:"em",h1:"h1",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.h1,{id:"installation",children:"Installation"}),"\n",(0,n.jsx)(r.p,{children:"To use Puppeteer in your project, run:"}),"\n",(0,n.jsxs)(o.Z,{groupId:"npm2yarn",children:[(0,n.jsx)(l.Z,{value:"npm",children:(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-bash",children:"npm i puppeteer\n"})})}),(0,n.jsx)(l.Z,{value:"yarn",label:"Yarn",children:(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-bash",children:"yarn add puppeteer\n"})})}),(0,n.jsx)(l.Z,{value:"pnpm",label:"pnpm",children:(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-bash",children:"pnpm add puppeteer\n"})})})]}),"\n",(0,n.jsxs)(r.p,{children:["When you install Puppeteer, it automatically downloads a recent version of\n",(0,n.jsx)(r.a,{href:"https://developer.chrome.com/blog/chrome-for-testing/",children:"Chrome for Testing"})," (~170MB macOS, ~282MB Linux, ~280MB Windows) and a ",(0,n.jsx)(r.code,{children:"chrome-headless-shell"})," binary (starting with Puppeteer v21.6.0) that is ",(0,n.jsx)(r.a,{href:"https://pptr.dev/faq#q-why-doesnt-puppeteer-vxxx-work-with-chromium-vyyy",children:"guaranteed to\nwork"}),"\nwith Puppeteer. The browser is downloaded to the ",(0,n.jsx)(r.code,{children:"$HOME/.cache/puppeteer"})," folder\nby default (starting with Puppeteer v19.0.0). See ",(0,n.jsx)(r.a,{href:"https://pptr.dev/api/puppeteer.configuration",children:"configuration"})," for configuration options and environmental variables to control the download behavior."]}),"\n",(0,n.jsx)(r.p,{children:"For every release since v1.7.0 we publish two packages:"}),"\n",(0,n.jsxs)(r.ul,{children:["\n",(0,n.jsx)(r.li,{children:(0,n.jsx)(r.a,{href:"https://www.npmjs.com/package/puppeteer",children:(0,n.jsx)(r.code,{children:"puppeteer"})})}),"\n",(0,n.jsx)(r.li,{children:(0,n.jsx)(r.a,{href:"https://www.npmjs.com/package/puppeteer-core",children:(0,n.jsx)(r.code,{children:"puppeteer-core"})})}),"\n"]}),"\n",(0,n.jsxs)(r.p,{children:[(0,n.jsx)(r.code,{children:"puppeteer"})," is a ",(0,n.jsx)(r.em,{children:"product"})," for browser automation. When installed, it downloads\na version of Chrome, which it then drives using ",(0,n.jsx)(r.code,{children:"puppeteer-core"}),". Being an\nend-user product, ",(0,n.jsx)(r.code,{children:"puppeteer"})," automates several workflows using reasonable\ndefaults ",(0,n.jsx)(r.a,{href:"https://pptr.dev/guides/configuration",children:"that can be customized"}),"."]}),"\n",(0,n.jsxs)(r.p,{children:[(0,n.jsx)(r.code,{children:"puppeteer-core"})," is a ",(0,n.jsx)(r.em,{children:"library"})," to help drive anything that supports DevTools\nprotocol. Being a library, ",(0,n.jsx)(r.code,{children:"puppeteer-core"})," is fully driven through its\nprogrammatic interface implying no defaults are assumed and ",(0,n.jsx)(r.code,{children:"puppeteer-core"}),"\nwill not download Chrome when installed."]}),"\n",(0,n.jsxs)(r.p,{children:["You should use ",(0,n.jsx)(r.code,{children:"puppeteer-core"})," if you are\n",(0,n.jsx)(r.a,{href:"https://pptr.dev/api/puppeteer.puppeteer.connect",children:"connecting to a remote browser"}),"\nor ",(0,n.jsx)(r.a,{href:"https://pptr.dev/browsers-api/",children