mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
2 lines
7.6 KiB
JavaScript
2 lines
7.6 KiB
JavaScript
|
/*! For license information please see c46890a4.6a4b0735.js.LICENSE.txt */
|
||
|
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[15216],{65348:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>s,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var r=n(85893),i=n(11151);const l={sidebar_label:"ElementHandle.waitForXPath"},s="ElementHandle.waitForXPath() method",o={id:"api/puppeteer.elementhandle.waitforxpath",title:"ElementHandle.waitForXPath() method",description:"Warning: This API is now obsolete.",source:"@site/../docs/api/puppeteer.elementhandle.waitforxpath.md",sourceDirName:"api",slug:"/api/puppeteer.elementhandle.waitforxpath",permalink:"/next/api/puppeteer.elementhandle.waitforxpath",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{sidebar_label:"ElementHandle.waitForXPath"},sidebar:"api",previous:{title:"ElementHandle.waitForSelector",permalink:"/next/api/puppeteer.elementhandle.waitforselector"},next:{title:"HTTPRequest",permalink:"/next/api/puppeteer.httprequest"}},a={},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",blockquote:"blockquote",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:"elementhandlewaitforxpath-method",children:"ElementHandle.waitForXPath() method"}),"\n",(0,r.jsxs)(t.blockquote,{children:["\n",(0,r.jsx)(t.p,{children:"Warning: This API is now obsolete."}),"\n",(0,r.jsxs)(t.p,{children:["Use ",(0,r.jsx)(t.a,{href:"/next/api/puppeteer.elementhandle.waitforselector",children:"ElementHandle.waitForSelector()"})," with the ",(0,r.jsx)(t.code,{children:"xpath"})," prefix."]}),"\n",(0,r.jsxs)(t.p,{children:["Example: ",(0,r.jsx)(t.code,{children:"await elementHandle.waitForSelector('xpath/' + xpathExpression)"})]}),"\n",(0,r.jsx)(t.p,{children:"The method evaluates the XPath expression relative to the elementHandle."}),"\n",(0,r.jsxs)(t.p,{children:["Wait for the ",(0,r.jsx)(t.code,{children:"xpath"})," within the element. 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.jsxs)(t.p,{children:["If ",(0,r.jsx)(t.code,{children:"xpath"})," starts with ",(0,r.jsx)(t.code,{children:"//"})," instead of ",(0,r.jsx)(t.code,{children:".//"}),", the dot will be appended automatically."]}),"\n"]}),"\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 ElementHandle {\n waitForXPath(\n xpath: string,\n options?: {\n visible?: boolean;\n hidden?: boolean;\n timeout?: number;\n }\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:"{ visible?: boolean; hidden?: boolean; timeout?: number; }"}),(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",childr
|