puppeteer/assets/js/c0e07d5a.993e47cc.js
release-please[bot] cc95c085a2 deploy: 1014abc087
2023-11-29 13:34:30 +00:00

2 lines
4.9 KiB
JavaScript

/*! For license information please see c0e07d5a.993e47cc.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[52797],{83150:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>a});var s=r(85893),o=r(11151);const i={sidebar_label:"FileChooser"},l="FileChooser class",n={id:"api/puppeteer.filechooser",title:"FileChooser class",description:"File choosers let you react to the page requesting for a file.",source:"@site/../docs/api/puppeteer.filechooser.md",sourceDirName:"api",slug:"/api/puppeteer.filechooser",permalink:"/next/api/puppeteer.filechooser",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{sidebar_label:"FileChooser"},sidebar:"api",previous:{title:"Tracing.stop",permalink:"/next/api/puppeteer.tracing.stop"},next:{title:"FileChooser.accept",permalink:"/next/api/puppeteer.filechooser.accept"}},c={},a=[{value:"Signature:",id:"signature",level:4},{value:"Remarks",id:"remarks",level:2},{value:"Example",id:"example",level:2},{value:"Methods",id:"methods",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h4:"h4",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h1,{id:"filechooser-class",children:"FileChooser class"}),"\n",(0,s.jsx)(t.p,{children:"File choosers let you react to the page requesting for a file."}),"\n",(0,s.jsx)(t.h4,{id:"signature",children:"Signature:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-typescript",children:"export declare class FileChooser\n"})}),"\n",(0,s.jsx)(t.h2,{id:"remarks",children:"Remarks"}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"FileChooser"})," instances are returned via the ",(0,s.jsx)(t.a,{href:"/next/api/puppeteer.page.waitforfilechooser",children:"Page.waitForFileChooser()"})," method."]}),"\n",(0,s.jsx)(t.p,{children:"In browsers, only one file chooser can be opened at a time. All file choosers must be accepted or canceled. Not doing so will prevent subsequent file choosers from appearing."}),"\n",(0,s.jsxs)(t.p,{children:["The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ",(0,s.jsx)(t.code,{children:"FileChooser"})," class."]}),"\n",(0,s.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",children:"const [fileChooser] = await Promise.all([\n page.waitForFileChooser(),\n page.click('#upload-file-button'), // some button that triggers file selection\n]);\nawait fileChooser.accept(['/tmp/myfile.pdf']);\n"})}),"\n",(0,s.jsx)(t.h2,{id:"methods",children:"Methods"}),"\n",(0,s.jsxs)(t.table,{children:[(0,s.jsx)(t.thead,{children:(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.th,{children:"Method"}),(0,s.jsx)(t.th,{children:"Modifiers"}),(0,s.jsx)(t.th,{children:"Description"})]})}),(0,s.jsxs)(t.tbody,{children:[(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:(0,s.jsx)(t.a,{href:"/next/api/puppeteer.filechooser.accept",children:"accept(paths)"})}),(0,s.jsx)(t.td,{}),(0,s.jsx)(t.td,{children:"Accept the file chooser request with the given file paths."})]}),(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:(0,s.jsx)(t.a,{href:"/next/api/puppeteer.filechooser.cancel",children:"cancel()"})}),(0,s.jsx)(t.td,{}),(0,s.jsx)(t.td,{children:"Closes the file chooser without selecting any files."})]}),(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:(0,s.jsx)(t.a,{href:"/next/api/puppeteer.filechooser.ismultiple",children:"isMultiple()"})}),(0,s.jsx)(t.td,{}),(0,s.jsxs)(t.td,{children:["Whether file chooser allow for ",(0,s.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple",children:"multiple"})," file selection."]})]})]})]})]})}function p(e={}){const{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},75251:(e,t,r)=>{var s=r(67294),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,n=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function a(e,t,r){var s,i={},a=null,h=null;for(s in void 0!==r&&(a=""+r),void 0!==t.key&&(a=""+t.key),void 0!==t.ref&&(h=t.ref),t)l.call(t,s)&&!c.hasOwnProperty(s)&&(i[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===i[s]&&(i[s]=t[s]);return{$$typeof:o,type:e,key:a,ref:h,props:i,_owner:n.current}}t.Fragment=i,t.jsx=a,t.jsxs=a},85893:(e,t,r)=>{e.exports=r(75251)},11151:(e,t,r)=>{r.d(t,{Z:()=>n,a:()=>l});var s=r(67294);const o={},i=s.createContext(o);function l(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function n(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:l(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]);