Skip to content

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

chore: remove deprecated `devtools` option (#38392)

Dmitry Gozman1ba4f6659e5c
diff --git a/docs/src/api/params.md b/docs/src/api/params.md
index 37f6665a93..d04354f8e0 100644
--- a/docs/src/api/params.md
+++ b/docs/src/api/params.md
@@ -1078,8 +1078,7 @@ Close the browser process on SIGHUP. Defaults to `true`.
Whether to run browser in headless mode. More details for
[Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
-[Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
-[`option: BrowserType.launch.devtools`] option is `true`.
+[Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
## js-python-browser-option-firefoxuserprefs
* langs: js, python
@@ -1117,13 +1116,6 @@ disable timeout.
If specified, traces are saved into this directory.
-## browser-option-devtools
-* deprecated: Use [debugging tools](../debug.md) instead.
-- `devtools` <[boolean]>
-
-**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
-[`option: headless`] option will be set `false`.
-
## browser-option-slowmo
- `slowMo` <[float]>
@@ -1133,7 +1125,6 @@ Slows down Playwright operations by the specified amount of milliseconds. Useful
- %%-browser-option-args-%%
- %%-browser-option-channel-%%
- %%-browser-option-chromiumsandbox-%%
-- %%-browser-option-devtools-%%
- %%-browser-option-downloadspath-%%
- %%-csharp-java-browser-option-env-%%
- %%-js-browser-option-env-%%
diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.ts
index 5e9b254130..d6ff2f0ace 100644
--- a/packages/playwright-client/types/types.d.ts
+++ b/packages/playwright-client/types/types.d.ts
@@ -14998,14 +14998,6 @@ export interface BrowserType<Unused = {}> {
*/
deviceScaleFactor?: number;
- /**
- * **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
- * [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-headless)
- * option will be set `false`.
- * @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
- */
- devtools?: boolean;
-
/**
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
@@ -15085,9 +15077,7 @@ export interface BrowserType<Unused = {}> {
/**
* Whether to run browser in headless mode. More details for
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
- * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
- * [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
- * `true`.
+ * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
*/
headless?: boolean;
@@ -15428,14 +15418,6 @@ export interface BrowserType<Unused = {}> {
*/
chromiumSandbox?: boolean;
- /**
- * **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
- * [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server-option-headless) option
- * will be set `false`.
- * @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
- */
- devtools?: boolean;
-
/**
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
@@ -15480,9 +15462,7 @@ export interface BrowserType<Unused = {}> {
/**
* Whether to run browser in headless mode. More details for
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
- * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
- * [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
- * `true`.
+ * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
*/
headless?: boolean;
@@ -21763,14 +21743,6 @@ export interface LaunchOptions {
*/
chromiumSandbox?: boolean;
- /**
- * **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
- * [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-headless) option will be
- * set `false`.
- * @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
- */
- devtools?: boolean;
-
/**
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
@@ -21815,9 +21787,7 @@ export interface LaunchOptions {
/**
* Whether to run browser in headless mode. More details for
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
- * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
- * [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
- * `true`.
+ * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
*/
headless?: boolean;
diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.ts
index 18980d8e18..91f26b64c6 100644
--- a/packages/playwright-core/src/protocol/validator.ts
+++ b/packages/playwright-core/src/protocol/validator.ts
@@ -506,7 +506,6 @@ scheme.BrowserTypeLaunchParams = tObject({
timeout: tFloat,
env: tOptional(tArray(tType('NameValue'))),
headless: tOptional(tBoolean),
- devtools: tOptional(tBoolean),
proxy: tOptional(tObject({
server: tString,
bypass: tOptional(tString),
@@ -536,7 +535,6 @@ scheme.BrowserTypeLaunchPersistentContextParams = tObject({
timeout: tFloat,
env: tOptional(tArray(tType('NameValue'))),
headless: tOptional(tBoolean),
- devtools: tOptional(tBoolean),
proxy: tOptional(tObject({
server: tString,
bypass: tOptional(tString),
diff --git a/packages/playwright-core/src/remote/playwrightServer.ts b/packages/playwright-core/src/remote/playwrightServer.ts
index a22ec51bd3..e901bf508b 100644
--- a/packages/playwright-core/src/remote/playwrightServer.ts
+++ b/packages/playwright-core/src/remote/playwrightServer.ts
@@ -375,7 +375,6 @@ const defaultLaunchOptions: Partial<LaunchOptionsWithTimeout> = {
handleSIGTERM: false,
handleSIGHUP: false,
headless: true,
- devtools: false,
};
const optionsThatAllowBrowserReuse: (keyof LaunchOptionsWithTimeout)[] = [
diff --git a/packages/playwright-core/src/server/bidi/bidiChromium.ts b/packages/playwright-core/src/server/bidi/bidiChromium.ts
index e05e023875..18071378b0 100644
--- a/packages/playwright-core/src/server/bidi/bidiChromium.ts
+++ b/packages/playwright-core/src/server/bidi/bidiChromium.ts
@@ -123,8 +123,6 @@ export class BidiChromium extends BrowserType {
chromeArguments.push('--enable-unsafe-swiftshader');
}
- if (options.devtools)
- chromeArguments.push('--auto-open-devtools-for-tabs');
if (options.headless) {
chromeArguments.push('--headless');
diff --git a/packages/playwright-core/src/server/browserType.ts b/packages/playwright-core/src/server/browserType.ts
index e370491788..b4f843f22a 100644
--- a/packages/playwright-core/src/server/browserType.ts
+++ b/packages/playwright-core/src/server/browserType.ts
@@ -293,15 +293,14 @@ export abstract class BrowserType extends SdkObject {
}
private _validateLaunchOptions(options: types.LaunchOptions): types.LaunchOptions {
- const { devtools = false } = options;
- let { headless = !devtools, downloadsPath, proxy } = options;
+ let { headless = true, downloadsPath, proxy } = options;
if (debugMode() === 'inspector')
headless = false;
if (downloadsPath && !path.isAbsolute(downloadsPath))
downloadsPath = path.join(process.cwd(), downloadsPath);
if (options.socksProxyPort)
proxy = { server: `socks5://127.0.0.1:${options.socksProxyPort}` };
- return { ...options, devtools, headless, downloadsPath, proxy };
+ return { ...options, headless, downloadsPath, proxy };
}
protected _createUserDataDirArgMisuseError(userDataDirArg: string): Error {
diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.ts
index 4adebfe579..6eff859ae7 100644
--- a/packages/playwright-core/src/server/chromium/chromium.ts
+++ b/packages/playwright-core/src/server/chromium/chromium.ts
@@ -141,13 +141,8 @@ export class Chromium extends BrowserType {
}
override async connectToTransport(transport: ConnectionTransport, options: BrowserOptions, browserLogsCollector: RecentLogsCollector): Promise<CRBrowser> {
- let devtools = this._devtools;
- if ((options as any).__testHookForDevTools) {
- devtools = this._createDevTools();
- await (options as any).__testHookForDevTools(devtools);
- }
try {
- return await CRBrowser.connect(this.attribution.playwright, transport, options, devtools);
+ return await CRBrowser.connect(this.attribution.playwright, transport, options, this._devtools);
} catch (e) {
if (browserLogsCollector.recentLogs().some(log => log.includes('Failed to create a ProcessSingleton for your profile directory.'))) {
throw new Error(
@@ -326,8 +321,6 @@ export class Chromium extends BrowserType {
chromeArguments.push('--enable-unsafe-swiftshader');
}
- if (options.devtools)
- chromeArguments.push('--auto-open-devtools-for-tabs');
if (options.headless) {
chromeArguments.push('--headless');
diff --git a/packages/playwright-core/src/server/chromium/crDevTools.ts b/packages/playwright-core/src/server/chromium/crDevTools.ts
index 5225d6d54f..74aa11c645 100644
--- a/packages/playwright-core/src/server/chromium/crDevTools.ts
+++ b/packages/playwright-core/src/server/chromium/crDevTools.ts
@@ -26,7 +26,6 @@ export class CRDevTools {
private _preferencesPath: string;
private _prefs: any;
private _savePromise: Promise<any>;
- __testHookOnBinding?: (parsed: any) => any;
constructor(preferencesPath: string) {
this._preferencesPath = preferencesPath;
@@ -39,8 +38,6 @@ export class CRDevTools {
return;
const parsed = JSON.parse(event.payload);
let result = undefined;
- if (this.__testHookOnBinding)
- this.__testHookOnBinding(parsed);
if (parsed.method === 'getPreferences') {
if (this._prefs === undefined) {
try {
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index 5e9b254130..d6ff2f0ace 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -14998,14 +14998,6 @@ export interface BrowserType<Unused = {}> {
*/
deviceScaleFactor?: number;
- /**
- * **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
- * [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-headless)
- * option will be set `false`.
- * @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
- */
- devtools?: boolean;
-
/**
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
@@ -15085,9 +15077,7 @@ export interface BrowserType<Unused = {}> {
/**
* Whether to run browser in headless mode. More details for
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
- * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
- * [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
- * `true`.
+ * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
*/
headless?: boolean;
@@ -15428,14 +15418,6 @@ export interface BrowserType<Unused = {}> {
*/
chromiumSandbox?: boolean;
- /**
- * **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
- * [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server-option-headless) option
- * will be set `false`.
- * @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
- */
- devtools?: boolean;
-
/**
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
@@ -15480,9 +15462,7 @@ export interface BrowserType<Unused = {}> {
/**
* Whether to run browser in headless mode. More details for
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
- * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
- * [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
- * `true`.
+ * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
*/
headless?: boolean;
@@ -21763,14 +21743,6 @@ export interface LaunchOptions {
*/
chromiumSandbox?: boolean;
- /**
- * **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the
- * [`headless`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-headless) option will be
- * set `false`.
- * @deprecated Use [debugging tools](https://playwright.dev/docs/debug) instead.
- */
- devtools?: boolean;
-
/**
* If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and
* is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were
@@ -21815,9 +21787,7 @@ export interface LaunchOptions {
/**
* Whether to run browser in headless mode. More details for
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
- * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
- * [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
- * `true`.
+ * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
*/
headless?: boolean;
diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts
index 3a9817f1fa..6691642fc1 100644
--- a/packages/playwright/types/test.d.ts
+++ b/packages/playwright/types/test.d.ts
@@ -6747,9 +6747,7 @@ export interface PlaywrightWorkerOptions {
/**
* Whether to run browser in headless mode. More details for
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
- * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true` unless the
- * [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
- * `true`.
+ * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
*
* **Usage**
*
diff --git a/packages/protocol/src/channels.d.ts b/packages/protocol/src/channels.d.ts
index 8a2e3db8ac..9b52395916 100644
--- a/packages/protocol/src/channels.d.ts
+++ b/packages/protocol/src/channels.d.ts
@@ -887,7 +887,6 @@ export type BrowserTypeLaunchParams = {
timeout: number,
env?: NameValue[],
headless?: boolean,
- devtools?: boolean,
proxy?: {
server: string,
bypass?: string,
@@ -913,7 +912,6 @@ export type BrowserTypeLaunchOptions = {
handleSIGHUP?: boolean,
env?: NameValue[],
headless?: boolean,
- devtools?: boolean,
proxy?: {
server: string,
bypass?: string,
@@ -943,7 +941,6 @@ export type BrowserTypeLaunchPersistentContextParams = {
timeout: number,
env?: NameValue[],
headless?: boolean,
- devtools?: boolean,
proxy?: {
server: string,
bypass?: string,
@@ -1026,7 +1023,6 @@ export type BrowserTypeLaunchPersistentContextOptions = {
handleSIGHUP?: boolean,
env?: NameValue[],
headless?: boolean,
- devtools?: boolean,
proxy?: {
server: string,
bypass?: string,
diff --git a/packages/protocol/src/protocol.yml b/packages/protocol/src/protocol.yml
index 2f535bf644..a9573b1bcb 100644
--- a/packages/protocol/src/protocol.yml
+++ b/packages/protocol/src/protocol.yml
@@ -467,7 +467,6 @@ LaunchOptions:
type: array?
items: NameValue
headless: boolean?
- devtools: boolean?
proxy:
type: object?
properties:
diff --git a/tests/library/chromium/launcher.spec.ts b/tests/library/chromium/launcher.spec.ts
index 4d03dd2e4a..6c63b03c7a 100644
--- a/tests/library/chromium/launcher.spec.ts
+++ b/tests/library/chromium/launcher.spec.ts
@@ -34,24 +34,6 @@ it('should not throw with remote-debugging-port argument', async ({ browserType,
await browser.close();
});
-it('should open devtools when "devtools: true" option is given', async ({ browserType, mode, platform, channel }) => {
- it.skip(mode !== 'default' || platform === 'win32' || !!channel);
-
- let devtoolsCallback;
- const devtoolsPromise = new Promise(f => devtoolsCallback = f);
- const __testHookForDevTools = devtools => devtools.__testHookOnBinding = parsed => {
- if (parsed.method === 'getPreferences')
- devtoolsCallback();
- };
- const browser = await browserType.launch({ headless: false, devtools: true, __testHookForDevTools } as any);
- const context = await browser.newContext();
- await Promise.all([
- devtoolsPromise,
- context.newPage()
- ]);
- await browser.close();
-});
-
it('should not create pages automatically', async ({ browserType }) => {
const browser = await browserType.launch();
const browserSession = await browser.newBrowserCDPSession();
diff --git a/tests/library/playwright.config.ts b/tests/library/playwright.config.ts
index fdfbfb66b3..4fbe899cee 100644
--- a/tests/library/playwright.config.ts
+++ b/tests/library/playwright.config.ts
@@ -113,7 +113,6 @@ for (const browserName of browserNames) {
const executablePath = getExecutablePath(browserName);
if (executablePath && !process.env.TEST_WORKER_INDEX)
console.error(`Using executable at ${executablePath}`);
- const devtools = process.env.DEVTOOLS === '1';
const testIgnore: RegExp[] = browserNames.filter(b => b !== browserName).map(b => new RegExp(b));
const projectTemplate: typeof config.projects[0] = {
@@ -127,7 +126,6 @@ for (const browserName of browserNames) {
video: video ? 'on' : undefined,
launchOptions: {
executablePath,
- devtools
},
trace: trace ? 'on' : undefined,
},
diff --git a/utils/generate_types/test/test.ts b/utils/generate_types/test/test.ts
index a71dab64b0..aba7594597 100644
--- a/utils/generate_types/test/test.ts
+++ b/utils/generate_types/test/test.ts
@@ -226,7 +226,6 @@ playwright.chromium.launch().then(async browser => {
// Test v0.12 features
(async () => {
const launchOptions: playwright.LaunchOptions = {
- devtools: true,
env: {
TIMEOUT: '52',
SOMETHING: '/some/path',