/*! For license information please see 86c2827d.ee20cf16.js.LICENSE.txt */ "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[67399],{97260:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>a,toc:()=>c});var o=n(85893),r=n(11151);const i={},s="Files",a={id:"guides/files",title:"Files",description:"Currently, Puppeteer does not offer a way to handle file downloads in a programmtic way.",source:"@site/versioned_docs/version-22.8.2/guides/files.md",sourceDirName:"guides",slug:"/guides/files",permalink:"/guides/files",draft:!1,unlisted:!1,tags:[],version:"22.8.2",frontMatter:{},sidebar:"docs",previous:{title:"Cookies",permalink:"/guides/cookies"},next:{title:"Integrations",permalink:"/category/integrations"}},l={},c=[];function d(e){const t={a:"a",code:"code",h1:"h1",p:"p",pre:"pre",...(0,r.a)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.h1,{id:"files",children:"Files"}),"\n",(0,o.jsxs)(t.p,{children:["Currently, Puppeteer does not offer a way to handle file downloads in a programmtic way.\nFor uploading files, you need to locate a file input element and call ",(0,o.jsx)(t.a,{href:"https://pptr.dev/api/puppeteer.elementhandle.uploadfile/",children:(0,o.jsx)(t.code,{children:"ElementHandle.uploadFile"})}),"."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const fileElement = await page.waitForSelector('input[type=file]');\nawait fileElement.uploadFile(['./path-to-local-file']);\n"})})]})}function p(e={}){const{wrapper:t}={...(0,r.a)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},75251:(e,t,n)=>{var o=n(67294),r=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var o,i={},c=null,d=null;for(o in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(d=t.ref),t)s.call(t,o)&&!l.hasOwnProperty(o)&&(i[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===i[o]&&(i[o]=t[o]);return{$$typeof:r,type:e,key:c,ref:d,props:i,_owner:a.current}}t.Fragment=i,t.jsx=c,t.jsxs=c},85893:(e,t,n)=>{e.exports=n(75251)},11151:(e,t,n)=>{n.d(t,{Z:()=>a,a:()=>s});var o=n(67294);const r={},i=o.createContext(r);function s(e){const t=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),o.createElement(i.Provider,{value:t},e.children)}}}]);