mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
2 lines
4.5 KiB
JavaScript
2 lines
4.5 KiB
JavaScript
/*! For license information please see 8da3f89f.6b22d9d3.js.LICENSE.txt */
|
|
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[37970],{86859:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>o,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var i=t(85893),n=t(11151);const a={sidebar_label:"Frame.waitForTimeout"},o="Frame.waitForTimeout() method",s={id:"api/puppeteer.frame.waitfortimeout",title:"Frame.waitForTimeout() method",description:"Warning: This API is now obsolete.",source:"@site/versioned_docs/version-21.6.0/api/puppeteer.frame.waitfortimeout.md",sourceDirName:"api",slug:"/api/puppeteer.frame.waitfortimeout",permalink:"/api/puppeteer.frame.waitfortimeout",draft:!1,unlisted:!1,tags:[],version:"21.6.0",frontMatter:{sidebar_label:"Frame.waitForTimeout"},sidebar:"api",previous:{title:"Frame.waitForSelector",permalink:"/api/puppeteer.frame.waitforselector"},next:{title:"Frame.waitForXPath",permalink:"/api/puppeteer.frame.waitforxpath"}},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 d(e){const r={a:"a",blockquote:"blockquote",code:"code",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,n.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.h1,{id:"framewaitfortimeout-method",children:"Frame.waitForTimeout() method"}),"\n",(0,i.jsxs)(r.blockquote,{children:["\n",(0,i.jsx)(r.p,{children:"Warning: This API is now obsolete."}),"\n",(0,i.jsxs)(r.p,{children:["Replace with ",(0,i.jsx)(r.code,{children:"new Promise(r => setTimeout(r, milliseconds));"}),"."]}),"\n",(0,i.jsx)(r.p,{children:"Causes your script to wait for the given number of milliseconds."}),"\n"]}),"\n",(0,i.jsx)(r.h4,{id:"signature",children:"Signature:"}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{className:"language-typescript",children:"class Frame {\n waitForTimeout(milliseconds: number): Promise<void>;\n}\n"})}),"\n",(0,i.jsx)(r.h2,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Parameter"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Description"})]})}),(0,i.jsx)(r.tbody,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"milliseconds"}),(0,i.jsx)(r.td,{children:"number"}),(0,i.jsx)(r.td,{children:"the number of milliseconds to wait."})]})})]}),"\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"Returns:"})}),"\n",(0,i.jsx)(r.p,{children:"Promise<void>"}),"\n",(0,i.jsx)(r.h2,{id:"remarks",children:"Remarks"}),"\n",(0,i.jsxs)(r.p,{children:["It's generally recommended to not wait for a number of seconds, but instead use ",(0,i.jsx)(r.a,{href:"/api/puppeteer.frame.waitforselector",children:"Frame.waitForSelector()"}),", ",(0,i.jsx)(r.a,{href:"/api/puppeteer.frame.waitforxpath",children:"Frame.waitForXPath()"})," or ",(0,i.jsx)(r.a,{href:"/api/puppeteer.frame.waitforfunction",children:"Frame.waitForFunction()"})," to wait for exactly the conditions you want."]}),"\n",(0,i.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(r.p,{children:"Wait for 1 second:"}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{className:"language-ts",children:"await frame.waitForTimeout(1000);\n"})})]})}function p(e={}){const{wrapper:r}={...(0,n.a)(),...e.components};return r?(0,i.jsx)(r,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},75251:(e,r,t)=>{var i=t(67294),n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=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,r,t){var i,a={},c=null,d=null;for(i in void 0!==t&&(c=""+t),void 0!==r.key&&(c=""+r.key),void 0!==r.ref&&(d=r.ref),r)o.call(r,i)&&!l.hasOwnProperty(i)&&(a[i]=r[i]);if(e&&e.defaultProps)for(i in r=e.defaultProps)void 0===a[i]&&(a[i]=r[i]);return{$$typeof:n,type:e,key:c,ref:d,props:a,_owner:s.current}}r.Fragment=a,r.jsx=c,r.jsxs=c},85893:(e,r,t)=>{e.exports=t(75251)},11151:(e,r,t)=>{t.d(r,{Z:()=>s,a:()=>o});var i=t(67294);const n={},a=i.createContext(n);function o(e){const r=i.useContext(a);return i.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function s(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:o(e.components),i.createElement(a.Provider,{value:r},e.children)}}}]); |