Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore(bidi): implement setInputFiles (#34757)
Yury Semikhatskyc2c336b97d91
diff --git a/packages/playwright-core/src/server/bidi/bidiPage.ts b/packages/playwright-core/src/server/bidi/bidiPage.tsindex 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<HTMLInputElement>, files: types.FilePayload[]): Promise<void> {- throw new Error('Method not implemented.');+ throw new Error('Setting FilePayloads is not supported in Bidi.');}async setInputFilePaths(handle: dom.ElementHandle<HTMLInputElement>, paths: string[]): Promise<void> {- 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<T extends Node>(handle: dom.ElementHandle<T>, to: dom.FrameExecutionContext): Promise<dom.ElementHandle<T>> {