Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: followRedirects in PlaywrightClient (#11599)

Dmitry Gozmana5bc2efc180e
diff --git a/packages/playwright-core/src/remote/playwrightClient.ts b/packages/playwright-core/src/remote/playwrightClient.ts
index 2b827d70d8..da2c5a4728 100644
--- a/packages/playwright-core/src/remote/playwrightClient.ts
+++ b/packages/playwright-core/src/remote/playwrightClient.ts
@@ -21,7 +21,8 @@ import { makeWaitForNextTask } from '../utils/utils';
export type PlaywrightClientConnectOptions = {
wsEndpoint: string;
- timeout?: number
+ timeout?: number;
+ followRedirects?: boolean;
};
export class PlaywrightClient {
@@ -30,10 +31,10 @@ export class PlaywrightClient {
private _closePromise: Promise<void>;
static async connect(options: PlaywrightClientConnectOptions): Promise<PlaywrightClient> {
- const { wsEndpoint, timeout = 30000 } = options;
+ const { wsEndpoint, timeout = 30000, followRedirects = true } = options;
const connection = new Connection();
connection.markAsRemote();
- const ws = new WebSocket(wsEndpoint);
+ const ws = new WebSocket(wsEndpoint, { followRedirects });
const waitForNextTask = makeWaitForNextTask();
connection.onmessage = message => {
if (ws.readyState === 2 /** CLOSING */ || ws.readyState === 3 /** CLOSED */)