diff --git a/packages/playwright-core/src/server/bidi/bidiPage.ts b/packages/playwright-core/src/server/bidi/bidiPage.ts index 82e57d8654..8cf9e38946 100644 --- a/packages/playwright-core/src/server/bidi/bidiPage.ts +++ b/packages/playwright-core/src/server/bidi/bidiPage.ts @@ -530,11 +530,21 @@ export class BidiPage implements PageDelegate { } async setInputFiles(handle: dom.ElementHandle, files: types.FilePayload[]): Promise { - throw new Error('Method not implemented.'); + throw new Error('Setting FilePayloads is not supported in Bidi.'); } async setInputFilePaths(handle: dom.ElementHandle, paths: string[]): Promise { - throw new Error('Method not implemented.'); + const fromContext = toBidiExecutionContext(handle._context); + const shared = await fromContext.rawCallFunction('x => x', { handle: handle._objectId }); + // TODO: store sharedId in the handle. + if (!('sharedId' in shared)) + throw new Error('Element is not a node'); + const sharedId = shared.sharedId!; + await this._session.send('input.setFiles', { + context: this._session.sessionId, + element: { sharedId }, + files: paths, + }); } async adoptElementHandle(handle: dom.ElementHandle, to: dom.FrameExecutionContext): Promise> {