diff --git a/packages/puppeteer-core/src/api/Page.ts b/packages/puppeteer-core/src/api/Page.ts index 8e1fd58f..767128bd 100644 --- a/packages/puppeteer-core/src/api/Page.ts +++ b/packages/puppeteer-core/src/api/Page.ts @@ -2706,9 +2706,8 @@ export class Page extends EventEmitter { waitForXPath( xpath: string, options?: WaitForSelectorOptions - ): Promise | null>; - waitForXPath(): Promise | null> { - throw new Error('Not implemented'); + ): Promise | null> { + return this.mainFrame().waitForXPath(xpath, options); } /** diff --git a/packages/puppeteer-core/src/common/Page.ts b/packages/puppeteer-core/src/common/Page.ts index 5397143c..b8e12f30 100644 --- a/packages/puppeteer-core/src/common/Page.ts +++ b/packages/puppeteer-core/src/common/Page.ts @@ -57,7 +57,6 @@ import {TargetCloseError} from './Errors.js'; import {FileChooser} from './FileChooser.js'; import {FrameManager, FrameManagerEmittedEvents} from './FrameManager.js'; import {CDPKeyboard, CDPMouse, CDPTouchscreen} from './Input.js'; -import {WaitForSelectorOptions} from './IsolatedWorld.js'; import {MAIN_WORLD} from './IsolatedWorlds.js'; import { Credentials, @@ -1378,13 +1377,6 @@ export class CDPPage extends Page { return this.#mouse; } - override waitForXPath( - xpath: string, - options: WaitForSelectorOptions = {} - ): Promise | null> { - return this.mainFrame().waitForXPath(xpath, options); - } - /** * This method is typically coupled with an action that triggers a device * request from an api such as WebBluetooth. diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 609b2e9f..7924729b 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -269,6 +269,12 @@ "parameters": ["webDriverBiDi"], "expectations": ["PASS"] }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForXPath *", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, { "testIdPattern": "[accessibility.spec] *", "platforms": ["darwin", "linux", "win32"], @@ -1529,6 +1535,18 @@ "parameters": ["webDriverBiDi"], "expectations": ["PASS"] }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForXPath should run in specified frame", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"] + }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForXPath should throw when frame is detached", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"] + }, { "testIdPattern": "[waittask.spec] waittask specs Page.waitForTimeout waits for the given timeout before resolving", "platforms": ["darwin", "linux", "win32"],