puppeteer/assets/js/840f4d53.f96820a7.js

2 lines
6.9 KiB
JavaScript
Raw Normal View History

/*! For license information please see 840f4d53.f96820a7.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[93269],{79403:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var r=n(85893),i=n(11151);const a={sidebar_label:"Page.waitForXPath"},o="Page.waitForXPath() method",s={id:"api/puppeteer.page.waitforxpath",title:"Page.waitForXPath() method",description:"Wait for the xpath to appear in page. If at the moment of calling the method the xpath already exists, the method will return immediately. If the xpath doesn't appear after the timeout milliseconds of waiting, the function will throw.",source:"@site/../docs/api/puppeteer.page.waitforxpath.md",sourceDirName:"api",slug:"/api/puppeteer.page.waitforxpath",permalink:"/next/api/puppeteer.page.waitforxpath",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{sidebar_label:"Page.waitForXPath"},sidebar:"api",previous:{title:"Page.waitForTimeout",permalink:"/next/api/puppeteer.page.waitfortimeout"},next:{title:"Page.workers",permalink:"/next/api/puppeteer.page.workers"}},l={},d=[{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 h(e){const t={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h4:"h4",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h1,{id:"pagewaitforxpath-method",children:"Page.waitForXPath() method"}),"\n",(0,r.jsxs)(t.p,{children:["Wait for the ",(0,r.jsx)(t.code,{children:"xpath"})," to appear in page. If at the moment of calling the method the ",(0,r.jsx)(t.code,{children:"xpath"})," already exists, the method will return immediately. If the ",(0,r.jsx)(t.code,{children:"xpath"})," doesn't appear after the ",(0,r.jsx)(t.code,{children:"timeout"})," milliseconds of waiting, the function will throw."]}),"\n",(0,r.jsx)(t.h4,{id:"signature",children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"class Page {\n waitForXPath(\n xpath: string,\n options?: WaitForSelectorOptions\n ): Promise<ElementHandle<Node> | null>;\n}\n"})}),"\n",(0,r.jsx)(t.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Parameter"}),(0,r.jsx)(t.th,{children:"Type"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"xpath"}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsxs)(t.td,{children:["A ",(0,r.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/XPath",children:"xpath"})," of an element to wait for"]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"options"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.a,{href:"/next/api/puppeteer.waitforselectoroptions",children:"WaitForSelectorOptions"})}),(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.em,{children:"(Optional)"})," Optional waiting parameters"]})]})]})]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.strong,{children:"Returns:"})}),"\n",(0,r.jsxs)(t.p,{children:["Promise<",(0,r.jsx)(t.a,{href:"/next/api/puppeteer.elementhandle",children:"ElementHandle"}),"<Node> | null>"]}),"\n",(0,r.jsxs)(t.p,{children:["Promise which resolves when element specified by xpath string is added to DOM. Resolves to ",(0,r.jsx)(t.code,{children:"null"})," if waiting for ",(0,r.jsx)(t.code,{children:"hidden: true"})," and xpath is not found in DOM, otherwise resolves to ",(0,r.jsx)(t.code,{children:"ElementHandle"}),"."]}),"\n",(0,r.jsx)(t.h2,{id:"remarks",children:"Remarks"}),"\n",(0,r.jsxs)(t.p,{children:["The optional Argument ",(0,r.jsx)(t.code,{children:"options"})," have properties:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"visible"}),": A boolean to wait for element to be present in DOM and to be visible, i.e. to not h