"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[84189],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});vara=n(67294);functionr(e,t,n){returntine?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}functiono(e,t){varn=Object.keys(e);if(Object.getOwnPropertySymbols){vara=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){returnObject.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}returnn}functioni(e){for(vart=1;t<arguments.length;t++){varn=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}returne}functionl(e,t){if(null==e)return{};varn,a,r=function(e,t){if(null==e)return{};varn,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);returnr}(e,t);if(Object.getOwnPropertySymbols){varo=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}returnr}varp=a.createContext({}),u=function(e){vart=a.useContext(p),n=t;returne&&(n="function"==typeofe?e(t):i(i({},t),e)),n},s=function(e){vart=u(e.components);returna.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){vart=e.children;returna.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){varn=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),m=u(n),g=r,d=m["".concat(p,".").concat(g)]||m[g]||c[g]||o;returnn?a.createElement(d,i(i({ref:t},s),{},{components:n})):a.createElement(d,i({ref:t},s))}));functiong(e,t){varn=arguments,r=t&&t.mdxType;if("string"==typeofe||r){varo=n.length,i=newArray(o);i[0]=m;varl={};for(varpint)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeofe?e:r,i[1]=l;for(varu=2;u<o;u++)i[u]=n[u];returna.createElement.apply(null,i)}returna.createElement.apply(null,n)}m.displayName="MDXCreateElement"},27635:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>u});vara=n(87462),r=(n(67294),n(3905));consto={sidebar_label:"Page.waitForFunction"},i="Page.waitForFunction() method",l={unversionedId:"api/puppeteer.page.waitforfunction",id:"version-17.0.0/api/puppeteer.page.waitforfunction",title:"Page.waitForFunction() method",description:"Waits for a function to finish evaluating in the page's context.",source:"@site/versioned_docs/version-17.0.0/api/puppeteer.page.waitforfunction.md",sourceDirName:"api",slug:"/api/puppeteer.page.waitforfunction",permalink:"/api/puppeteer.page.waitforfunction",draft:!1,tags:[],version:"17.0.0",frontMatter:{sidebar_label:"Page.waitForFunction"},sidebar:"sidebar",previous:{title:"Page.waitForFrame",permalink:"/api/puppeteer.page.waitforframe"},next:{title:"Page.waitForNavigation",permalink:"/api/puppeteer.page.waitfornavigation"}},p={},u=[{value:"Parameters",id:"parameters",level:2},{value:"Example 1",id:"example-1",level:2},{value:"Example 2",id:"example-2",level:2},{value:"Example 3",id:"example-3",level:2}],s={toc:u};functionc(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"pagewaitforfunction-method"},"Page.waitForFunction() method"),(0,r.kt)("p",null,"Waits for a function to finish evaluating in the page's context."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Signature:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"class Page {\n waitForFunction<\n Params extends unknown[],\n Func extends EvaluateFunc<Params> = EvaluateFunc<Params>\n >(\n pageFunction: Func | string,\n options?: {\n timeout?: number;\n polling?: string | number;\n },\n ...args: Params\n ): Promise<HandleFor<Awaited<ReturnType<Func>>>>;\n}\n")),(0