Skip to content

Commit b2a39ff

Browse files
committed
cherry-pick(#33604): docs: update docs about headless shell
1 parent 1eea46b commit b2a39ff

File tree

2 files changed

+81
-43
lines changed

2 files changed

+81
-43
lines changed

docs/src/browsers.md

+66-11
Original file line numberDiff line numberDiff line change
@@ -338,30 +338,85 @@ dotnet test --settings:webkit.runsettings
338338

339339
For Google Chrome, Microsoft Edge and other Chromium-based browsers, by default, Playwright uses open source Chromium builds. Since the Chromium project is ahead of the branded browsers, when the world is on Google Chrome N, Playwright already supports Chromium N+1 that will be released in Google Chrome and Microsoft Edge a few weeks later.
340340

341-
Playwright ships a regular Chromium build for headed operations and a separate [Chromium headless shell](https://developer.chrome.com/blog/chrome-headless-shell) for headless mode. These two behave differently in some edge cases, but the majority of testing scenarios are not affected. Note this behavior has changed in Playwright version 1.49, see [issue #33566](https://github.com/microsoft/playwright/issues/33566) for details.
341+
Playwright ships a regular Chromium build for headed operations and a separate [chromium headless shell](https://developer.chrome.com/blog/chrome-headless-shell) for headless mode. See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for details.
342342

343-
#### Save on download size
343+
#### Optimize download size on CI
344344

345-
If you are only running tests in headless, for example on CI, you can avoid downloading a headed version of Chromium by specifying `chromium-headless-shell` during installation.
345+
If you are only running tests in headless mode, for example on CI, you can avoid downloading a regular version of Chromium by passing `--only-shell` during installation.
346346

347347
```bash js
348-
# When only running tests headlessly
349-
npx playwright install chromium-headless-shell firefox webkit
348+
# only running tests headlessly
349+
npx playwright install --with-deps --only-shell
350350
```
351351

352352
```bash java
353-
# When only running tests headlessly
354-
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install chromium-headless-shell firefox webkit"
353+
# only running tests headlessly
354+
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps --only-shell"
355355
```
356356

357357
```bash python
358-
# When only running tests headlessly
359-
playwright install chromium-headless-shell firefox webkit
358+
# only running tests headlessly
359+
playwright install --with-deps --only-shell
360360
```
361361

362362
```bash csharp
363-
# When only running tests headlessly
364-
pwsh bin/Debug/netX/playwright.ps1 install chromium-headless-shell firefox webkit
363+
# only running tests headlessly
364+
pwsh bin/Debug/netX/playwright.ps1 install --with-deps --only-shell
365+
```
366+
367+
#### Opt-in to new headless mode
368+
369+
You can opt into the new headless mode by using `'chromium'` channel. As [official Chrome documentation puts it](https://developer.chrome.com/blog/chrome-headless-shell):
370+
371+
> New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing.
372+
373+
See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for details.
374+
375+
```js
376+
import { defineConfig, devices } from '@playwright/test';
377+
378+
export default defineConfig({
379+
projects: [
380+
{
381+
name: 'chromium',
382+
use: { ...devices['Desktop Chrome'], channel: 'chromium' },
383+
},
384+
],
385+
});
386+
```
387+
388+
```java
389+
import com.microsoft.playwright.*;
390+
391+
public class Example {
392+
public static void main(String[] args) {
393+
try (Playwright playwright = Playwright.create()) {
394+
Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setChannel("chromium"));
395+
Page page = browser.newPage();
396+
// ...
397+
}
398+
}
399+
}
400+
```
401+
402+
```bash python
403+
pytest test_login.py --browser-channel chromium
404+
```
405+
406+
```xml csharp
407+
<?xml version="1.0" encoding="utf-8"?>
408+
<RunSettings>
409+
<Playwright>
410+
<BrowserName>chromium</BrowserName>
411+
<LaunchOptions>
412+
<Channel>chromium</Channel>
413+
</LaunchOptions>
414+
</Playwright>
415+
</RunSettings>
416+
```
417+
418+
```bash csharp
419+
dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Channel=chromium
365420
```
366421

367422
### Google Chrome & Microsoft Edge

docs/src/release-notes-js.md

+15-32
Original file line numberDiff line numberDiff line change
@@ -40,58 +40,41 @@ Learn more in the [aria snapshots guide](./aria-snapshots).
4040

4141
### Breaking: channels `chrome`, `msedge` and similar switch to new headless
4242

43-
Prior to this release, Playwright was running the old established implementation of [Chromium headless mode](https://developer.chrome.com/docs/chromium/headless). However, Chromium had entirely **switched to the new headless mode**, and **removed the old one**.
43+
This change affects you if you're using one of the following channels in your `playwright.config.ts`:
44+
- `chrome`, `chrome-dev`, `chrome-beta`, or `chrome-canary`
45+
- `msedge`, `msedge-dev`, `msedge-beta`, or `msedge-canary`
4446

45-
![Chromium Headless](https://github.com/user-attachments/assets/2829e86a-dfe2-4743-a6d4-2aa65beea890)
47+
#### What do I need to do?
4648

47-
If you are using a browser channel, for example `'chrome'` or `'msedge'`, the headless mode switch **will affect you**. Most likely, you will have to update some of your tests and all of your screenshot expectations. See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for more details.
49+
After updating to Playwright v1.49, run your test suite. If it still passes, you're good to go. If not, you will probably need to update your snapshots, and adapt some of your test code around PDF viewers and extensions. See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for more details.
4850

49-
#### Chromium headless shell
50-
51-
Starting with this release, Playwright downloads and runs two different browser builds - one is a regular headed chromium and the other is a chromium headless shell. This should be transparent to you, **no action is needed**. You can learn more in [issue #33566](https://github.com/microsoft/playwright/issues/33566).
52-
53-
If you are only running tests in headless, for example on CI, you can avoid downloading a headed version of Chromium by specifying `chromium-headless-shell` during installation.
54-
55-
```bash
56-
# only running tests headlessly
57-
npx playwright install chromium-headless-shell firefox webkit
58-
```
51+
### Other breaking changes
5952

60-
Playwright will skip downloading headed chromium build, and will use `chromium-headless-shell` when running headless.
53+
- There will be no more updates for WebKit on Ubuntu 20.04 and Debian 11. We recommend updating your OS to a later version.
54+
- Package `@playwright/experimental-ct-vue2` will no longer be updated.
55+
- Package `@playwright/experimental-ct-solid` will no longer be updated.
6156

62-
#### Opt-in to new headless
57+
### Try new Chromium headless
6358

64-
We encourage everyone to try and switch to the new headless by using the `chromium-next` channel.
59+
You can opt into the new headless mode by using `'chromium'` channel. As [official Chrome documentation puts it](https://developer.chrome.com/blog/chrome-headless-shell):
6560

66-
First, install this channel prior to running tests. Make sure to list all the browsers that you use.
61+
> New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing.
6762
68-
```bash
69-
npx playwright install chromium-next firefox webkit
70-
```
71-
72-
Then update your config file to specify `'chromium-next'` channel.
63+
See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for the list of possible breakages you could encounter and more details on Chromium headless. Please file an issue if you see any problems after opting in.
7364

7465
```js
7566
import { defineConfig, devices } from '@playwright/test';
67+
7668
export default defineConfig({
7769
projects: [
7870
{
7971
name: 'chromium',
80-
use: {
81-
...devices['Desktop Chrome'],
82-
channel: 'chromium-next',
83-
},
72+
use: { ...devices['Desktop Chrome'], channel: 'chromium' },
8473
},
8574
],
8675
});
8776
```
8877

89-
### Other breaking changes
90-
91-
- There will be no more updates for WebKit on Ubuntu 20.04 and Debian 11. We recommend updating your OS to a later version.
92-
- Package `@playwright/experimental-ct-vue2` will no longer be updated.
93-
- Package `@playwright/experimental-ct-solid` will no longer be updated.
94-
9578
### Miscellaneous
9679

9780
- `<canvas>` elements inside a snapshot now draw a preview.

0 commit comments

Comments
 (0)