Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions docs/src/api/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]>

Expand All @@ -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-%%
Expand Down
36 changes: 3 additions & 33 deletions packages/playwright-client/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions packages/playwright-core/src/protocol/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion packages/playwright-core/src/remote/playwrightServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ const defaultLaunchOptions: Partial<LaunchOptionsWithTimeout> = {
handleSIGTERM: false,
handleSIGHUP: false,
headless: true,
devtools: false,
};

const optionsThatAllowBrowserReuse: (keyof LaunchOptionsWithTimeout)[] = [
Expand Down
2 changes: 0 additions & 2 deletions packages/playwright-core/src/server/bidi/bidiChromium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
5 changes: 2 additions & 3 deletions packages/playwright-core/src/server/browserType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 1 addition & 8 deletions packages/playwright-core/src/server/chromium/chromium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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');

Expand Down
3 changes: 0 additions & 3 deletions packages/playwright-core/src/server/chromium/crDevTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
36 changes: 3 additions & 33 deletions packages/playwright-core/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 1 addition & 3 deletions packages/playwright/types/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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**
*
Expand Down
4 changes: 0 additions & 4 deletions packages/protocol/src/channels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,6 @@ export type BrowserTypeLaunchParams = {
timeout: number,
env?: NameValue[],
headless?: boolean,
devtools?: boolean,
proxy?: {
server: string,
bypass?: string,
Expand All @@ -913,7 +912,6 @@ export type BrowserTypeLaunchOptions = {
handleSIGHUP?: boolean,
env?: NameValue[],
headless?: boolean,
devtools?: boolean,
proxy?: {
server: string,
bypass?: string,
Expand Down Expand Up @@ -943,7 +941,6 @@ export type BrowserTypeLaunchPersistentContextParams = {
timeout: number,
env?: NameValue[],
headless?: boolean,
devtools?: boolean,
proxy?: {
server: string,
bypass?: string,
Expand Down Expand Up @@ -1026,7 +1023,6 @@ export type BrowserTypeLaunchPersistentContextOptions = {
handleSIGHUP?: boolean,
env?: NameValue[],
headless?: boolean,
devtools?: boolean,
proxy?: {
server: string,
bypass?: string,
Expand Down
1 change: 0 additions & 1 deletion packages/protocol/src/protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ LaunchOptions:
type: array?
items: NameValue
headless: boolean?
devtools: boolean?
proxy:
type: object?
properties:
Expand Down
18 changes: 0 additions & 18 deletions tests/library/chromium/launcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions tests/library/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand All @@ -127,7 +126,6 @@ for (const browserName of browserNames) {
video: video ? 'on' : undefined,
launchOptions: {
executablePath,
devtools
},
trace: trace ? 'on' : undefined,
},
Expand Down
1 change: 0 additions & 1 deletion utils/generate_types/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading