MCPcopy
hub / github.com/BuilderIO/gpt-crawler / waitForXPath

Function waitForXPath

src/core.ts:34–49  ·  view source on GitHub ↗
(page: Page, xpath: string, timeout: number)

Source from the content-addressed store, hash-verified

32}
33
34export async function waitForXPath(page: Page, xpath: string, timeout: number) {
35 await page.waitForFunction(
36 (xpath) => {
37 const elements = document.evaluate(
38 xpath,
39 document,
40 null,
41 XPathResult.ANY_TYPE,
42 null,
43 );
44 return elements.iterateNext() !== null;
45 },
46 xpath,
47 { timeout },
48 );
49}
50
51export async function crawl(config: Config) {
52 configSchema.parse(config);

Callers 1

requestHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected