diff --git a/docs/src/ci.md b/docs/src/ci.md index 818e08242a..2556cbf241 100644 --- a/docs/src/ci.md +++ b/docs/src/ci.md @@ -628,65 +628,15 @@ DEBUG=pw:browser dotnet test ## Running headed -By default, Playwright launches browsers in headless mode. This can be changed by passing a flag when the browser is launched. - -```js -// Works across chromium, firefox and webkit -const { chromium } = require('playwright'); -const browser = await chromium.launch({ headless: false }); -``` - -```java -// Works across chromium, firefox and webkit -import com.microsoft.playwright.*; - -public class Example { - public static void main(String[] args) { - try (Playwright playwright = Playwright.create()) { - BrowserType chromium = playwright.chromium(); - Browser browser = chromium.launch(new BrowserType.LaunchOptions().setHeadless(false)); - } - } -} -``` - -```python async -import asyncio -from playwright.async_api import async_playwright - -async def main(): - async with async_playwright() as p: - # Works across chromium, firefox and webkit - browser = await p.chromium.launch(headless=False) - -asyncio.run(main()) -``` - -```python sync -from playwright.sync_api import sync_playwright - -with sync_playwright() as p: - # Works across chromium, firefox and webkit - browser = p.chromium.launch(headless=False) -``` - -```csharp -using Microsoft.Playwright; - -using var playwright = await Playwright.CreateAsync(); -await playwright.Chromium.LaunchAsync(new() -{ - Headless = false -}); -``` +By default, Playwright launches browsers in headless mode. See in our [Running tests](./running-tests.md#run-tests-in-headed-mode) guide how to run tests in headed mode. On Linux agents, headed execution requires [Xvfb](https://en.wikipedia.org/wiki/Xvfb) to be installed. Our [Docker image](./docker.md) and GitHub Action have Xvfb pre-installed. To run browsers in headed mode with Xvfb, add `xvfb-run` before the actual command. ```bash js -xvfb-run node index.js +xvfb-run npx playwrght test ``` ```bash python -xvfb-run python test.py +xvfb-run pytest ``` ```bash java xvfb-run mvn test diff --git a/docs/src/running-tests-csharp.md b/docs/src/running-tests-csharp.md index d366526f26..3f6a0f23e1 100644 --- a/docs/src/running-tests-csharp.md +++ b/docs/src/running-tests-csharp.md @@ -22,7 +22,7 @@ Use the following command to run all tests. dotnet test ``` -### Run your tests in headed mode +### Run tests in headed mode Use the following command to run your tests in headed mode opening a browser window for each test. diff --git a/docs/src/running-tests-java.md b/docs/src/running-tests-java.md index 69943f5470..2ca2093a8a 100644 --- a/docs/src/running-tests-java.md +++ b/docs/src/running-tests-java.md @@ -85,6 +85,10 @@ See [here](./test-runners.md) for further details on how to run tests in paralle See experimental [JUnit integration](./junit.md) to automatically initialize Playwright objects and more. +### Run tests in headed mode + +If you prefer, you can run your tests in headed mode by using the `launch(new BrowserType.LaunchOptions().setHeadless(false))` option. + ## What's Next - [Debugging tests](./debug.md)