mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
/*! For license information please see 29cb99fd.ec3c24ce.js.LICENSE.txt */
|
|
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[64723],{89469:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(85893),o=n(11151);const i={},s="Files",l={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.10.1/guides/files.md",sourceDirName:"guides",slug:"/guides/files",permalink:"/guides/files",draft:!1,unlisted:!1,tags:[],version:"22.10.1",frontMatter:{},sidebar:"docs",previous:{title:"Cookies",permalink:"/guides/cookies"},next:{title:"Running Puppeteer in the browser",permalink:"/guides/running-puppeteer-in-the-browser"}},a={},p=[];function c(e){const t={a:"a",code:"code",h1:"h1",p:"p",pre:"pre",...(0,o.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h1,{id:"files",children:"Files"}),"\n",(0,r.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,r.jsx)(t.a,{href:"https://pptr.dev/api/puppeteer.elementhandle.uploadfile/",children:(0,r.jsx)(t.code,{children:"ElementHandle.uploadFile"})}),"."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"const fileElement = await page.waitForSelector('input[type=file]');\nawait fileElement.uploadFile(['./path-to-local-file']);\n"})})]})}function d(e={}){const{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},75251:(e,t,n)=>{var r=n(67294),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function p(e,t,n){var r,i={},p=null,c=null;for(r in void 0!==n&&(p=""+n),void 0!==t.key&&(p=""+t.key),void 0!==t.ref&&(c=t.ref),t)s.call(t,r)&&!a.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:p,ref:c,props:i,_owner:l.current}}t.Fragment=i,t.jsx=p,t.jsxs=p},85893:(e,t,n)=>{e.exports=n(75251)},11151:(e,t,n)=>{n.d(t,{Z:()=>l,a:()=>s});var r=n(67294);const o={},i=r.createContext(o);function s(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:t},e.children)}}}]); |