Headless mode in Playwright is a feature that lets you run browsers without a graphical user interface. This means the browser won't open any windows or tabs when running tests or scripts. By default, Playwright operates in headless mode. However, you can disable it by passing the headless: false
flag when launching the browser.
import { chromium } from '@playwright/test';
const browser = await chromium.launch({ headless: false });
Running in headless mode can speed up your tests and save system resources. But if you need to see what's happening in the browser for debugging, you can disable headless mode.
const browser = await chromium.launch({ headless: false, slowMo: 50 });
The slowMo
feature slows down script execution, making it easier to follow what's happening on screen.
In conclusion, headless mode is a great tool for efficient testing. But if you need to debug or see what's happening in real-time, you can easily disable it.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].