docs: remove redundant duplicate headed paragraph (#31298)
This commit is contained in:
parent
132ceff702
commit
4fff548fc6
|
|
@ -628,65 +628,15 @@ DEBUG=pw:browser dotnet test
|
||||||
|
|
||||||
## Running headed
|
## Running headed
|
||||||
|
|
||||||
By default, Playwright launches browsers in headless mode. This can be changed by passing a flag when the browser is launched.
|
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.
|
||||||
|
|
||||||
```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
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
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.
|
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
|
```bash js
|
||||||
xvfb-run node index.js
|
xvfb-run npx playwrght test
|
||||||
```
|
```
|
||||||
```bash python
|
```bash python
|
||||||
xvfb-run python test.py
|
xvfb-run pytest
|
||||||
```
|
```
|
||||||
```bash java
|
```bash java
|
||||||
xvfb-run mvn test
|
xvfb-run mvn test
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ Use the following command to run all tests.
|
||||||
dotnet test
|
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.
|
Use the following command to run your tests in headed mode opening a browser window for each test.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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
|
## What's Next
|
||||||
|
|
||||||
- [Debugging tests](./debug.md)
|
- [Debugging tests](./debug.md)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue