mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
2 lines
4.8 KiB
JavaScript
2 lines
4.8 KiB
JavaScript
|
/*! For license information please see 80084bab.c99551b5.js.LICENSE.txt */
|
||
|
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[61562],{68291:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>n,metadata:()=>s,toc:()=>c});var i=r(85893),o=r(11151);const n={sidebar_label:"Page.waitForFileChooser"},a="Page.waitForFileChooser() method",s={id:"api/puppeteer.page.waitforfilechooser",title:"Page.waitForFileChooser() method",description:"This method is typically coupled with an action that triggers file choosing.",source:"@site/../docs/api/puppeteer.page.waitforfilechooser.md",sourceDirName:"api",slug:"/api/puppeteer.page.waitforfilechooser",permalink:"/next/api/puppeteer.page.waitforfilechooser",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{sidebar_label:"Page.waitForFileChooser"},sidebar:"api",previous:{title:"Page.waitForDevicePrompt",permalink:"/next/api/puppeteer.page.waitfordeviceprompt"},next:{title:"Page.waitForFrame",permalink:"/next/api/puppeteer.page.waitforframe"}},l={},c=[{value:"Signature:",id:"signature",level:4},{value:"Parameters",id:"parameters",level:2},{value:"Remarks",id:"remarks",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",h4:"h4",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h1,{id:"pagewaitforfilechooser-method",children:"Page.waitForFileChooser() method"}),"\n",(0,i.jsx)(t.p,{children:"This method is typically coupled with an action that triggers file choosing."}),"\n",(0,i.jsx)(t.admonition,{type:"caution",children:(0,i.jsx)(t.p,{children:"This must be called before the file chooser is launched. It will not return a currently active file chooser."})}),"\n",(0,i.jsx)(t.h4,{id:"signature",children:"Signature:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-typescript",children:"class Page {\n abstract waitForFileChooser(\n options?: WaitTimeoutOptions\n ): Promise<FileChooser>;\n}\n"})}),"\n",(0,i.jsx)(t.h2,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{children:"Parameter"}),(0,i.jsx)(t.th,{children:"Type"}),(0,i.jsx)(t.th,{children:"Description"})]})}),(0,i.jsx)(t.tbody,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:"options"}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.a,{href:"/next/api/puppeteer.waittimeoutoptions",children:"WaitTimeoutOptions"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.em,{children:"(Optional)"})})]})})]}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.strong,{children:"Returns:"})}),"\n",(0,i.jsxs)(t.p,{children:["Promise<",(0,i.jsx)(t.a,{href:"/next/api/puppeteer.filechooser",children:"FileChooser"}),">"]}),"\n",(0,i.jsx)(t.h2,{id:"remarks",children:"Remarks"}),"\n",(0,i.jsxs)(t.p,{children:['In the "headful" browser, this method results in the native file picker dialog ',(0,i.jsx)(t.code,{children:"not showing up"})," for the user."]}),"\n",(0,i.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,i.jsxs)(t.p,{children:["The following example clicks a button that issues a file chooser and then responds with ",(0,i.jsx)(t.code,{children:"/tmp/myfile.pdf"})," as if a user has selected this file."]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",children:"const [fileChooser] = await Promise.all([\n page.waitForFileChooser(),\n page.click('#upload-file-button'),\n // some button that triggers file selection\n]);\nawait fileChooser.accept(['/tmp/myfile.pdf']);\n"})})]})}function h(e={}){const{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},75251:(e,t,r)=>{var i=r(67294),o=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,r){var i,n={},c=null,p=null;for(i in void 0!==r&&(c=""+r),vo
|