diff --git a/packages/playwright-core/src/remote/playwrightConnection.ts b/packages/playwright-core/src/remote/playwrightConnection.ts index 447140da10..c948ecb84b 100644 --- a/packages/playwright-core/src/remote/playwrightConnection.ts +++ b/packages/playwright-core/src/remote/playwrightConnection.ts @@ -16,6 +16,7 @@ import type { WebSocket } from '../utilsBundle'; import type { DispatcherScope, Playwright } from '../server'; +import type * as channels from '@protocol/channels'; import { createPlaywright, DispatcherConnection, RootDispatcher, PlaywrightDispatcher } from '../server'; import { Browser } from '../server/browser'; import { serverSideCallMetadata } from '../server/instrumentation'; @@ -94,21 +95,21 @@ export class PlaywrightConnection { return; } - this._root = new RootDispatcher(this._dispatcherConnection, async scope => { + this._root = new RootDispatcher(this._dispatcherConnection, async (scope, options) => { await startProfiling(); if (clientType === 'reuse-browser') return await this._initReuseBrowsersMode(scope); if (clientType === 'pre-launched-browser-or-android') return this._preLaunched.browser ? await this._initPreLaunchedBrowserMode(scope) : await this._initPreLaunchedAndroidMode(scope); if (clientType === 'launch-browser') - return await this._initLaunchBrowserMode(scope); + return await this._initLaunchBrowserMode(scope, options); throw new Error('Unsupported client type: ' + clientType); }); } - private async _initLaunchBrowserMode(scope: RootDispatcher) { + private async _initLaunchBrowserMode(scope: RootDispatcher, options: channels.RootInitializeParams) { debugLogger.log('server', `[${this._id}] engaged launch mode for "${this._options.browserName}"`); - const playwright = createPlaywright({ sdkLanguage: 'javascript', isServer: true }); + const playwright = createPlaywright({ sdkLanguage: options.sdkLanguage, isServer: true }); const ownedSocksProxy = await this._createOwnedSocksProxy(playwright); const browser = await playwright[this._options.browserName as 'chromium'].launch(serverSideCallMetadata(), this._options.launchOptions);