puppeteer/assets/js/ca9a4e00.d7f22a62.js

2 lines
14 KiB
JavaScript
Raw Normal View History

/*! For license information please see ca9a4e00.d7f22a62.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[89468],{24093:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var t=r(85893),o=r(11151);r(93070),r(50551);const i={},a="Configuration",s={id:"guides/configuration",title:"Configuration",description:"By default, Puppeteer downloads and uses a specific version of Chrome so its",source:"@site/versioned_docs/version-22.6.4/guides/configuration.mdx",sourceDirName:"guides",slug:"/guides/configuration",permalink:"/guides/configuration",draft:!1,unlisted:!1,tags:[],version:"22.6.4",frontMatter:{},sidebar:"docs",previous:{title:"Guides",permalink:"/category/guides"},next:{title:"Debugging",permalink:"/guides/debugging"}},l={},c=[{value:"Configuration files",id:"configuration-files",level:2},{value:"Examples",id:"examples",level:3},{value:"Changing the default cache directory",id:"changing-the-default-cache-directory",level:4},{value:"Environment variables",id:"environment-variables",level:2}];function u(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"configuration",children:"Configuration"}),"\n",(0,t.jsxs)(n.p,{children:["By default, Puppeteer downloads and uses a specific version of Chrome so its\nAPI is guaranteed to work out of the box. To use Puppeteer with a different\nversion of Chrome or Chromium, pass in the executable's path when creating a\n",(0,t.jsx)(n.code,{children:"Browser"})," instance:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["You can also use Puppeteer with Firefox. See\n",(0,t.jsx)(n.a,{href:"https://pptr.dev/faq#q-what-is-the-status-of-cross-browser-support",children:"status of cross-browser support"})," for\nmore information."]}),"\n","\n",(0,t.jsx)(n.p,{children:"All defaults in Puppeteer can be customized in two ways:"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.a,{href:"#configuration-files",children:"Configuration files"})," (",(0,t.jsx)(n.strong,{children:"recommended"}),")"]}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"#environment-variables",children:"Environment variables"})}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"caution",children:(0,t.jsxs)(n.p,{children:["Note that some options are only customizable through environment variables (such\nas ",(0,t.jsx)(n.code,{children:"HTTPS_PROXY"}),")."]})}),"\n",(0,t.jsx)(n.admonition,{type:"caution",children:(0,t.jsxs)(n.p,{children:["Puppeteer's configuration files and environment variables are ignored by ",(0,t.jsx)(n.code,{children:"puppeteer-core"}),"."]})}),"\n",(0,t.jsx)(n.h2,{id:"configuration-files",children:"Configuration files"}),"\n",(0,t.jsxs)(n.p,{children:["Configuration files are the ",(0,t.jsx)(n.strong,{children:"recommended"})," choice for configuring Puppeteer.\nPuppeteer will look up the file tree for any of the following formats:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:".puppeteerrc.cjs"}),","]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:".puppeteerrc.js"}),","]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:".puppeteerrc"})," (YAML/JSON),"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:".puppeteerrc.json"}),","]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:".puppeteerrc.yaml"}),","]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"puppeteer.config.js"}),", and"]}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"puppeteer.config.cjs"})}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["See the ",(0,t.jsx)(n.a,{href:"../api/puppeteer.configuration",children:(0,t.jsx)(n.code,{children:"Configuration"})})," interface for possible\noptions."]}),"\n",(0,t.jsx)(n.admonition,{type:"caut