puppeteer/assets/js/77209495.73f45877.js

2 lines
2.6 KiB
JavaScript
Raw Normal View History

/*! For license information please see 77209495.73f45877.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[47365],{8046:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>a,toc:()=>c});var r=n(85893),o=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/../docs/guides/files.md",sourceDirName:"guides",slug:"/guides/files",permalink:"/next/guides/files",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"Cookies",permalink:"/next/guides/cookies"},next:{title:"Integrations",permalink:"/next/category/integrations"}},l={},c=[];function d(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 p(e={}){const{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},75251:(e,t,n)=>{var r=n(67294),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__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 r,i={},c=null,d=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(d=t.ref),t)s.call(t,r)&&!l.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: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 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 a(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)}}}]);