puppeteer/assets/js/c125ac23.b3fe6f83.js

2 lines
4.5 KiB
JavaScript
Raw Normal View History

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