Playwright + Python · Lesson 14 of 37

0/37 done

Module 14: Installation & Setup

14. CLI Installation, Browser Binaries & Launch Options

14 minlesson

Your task

Implement make_launch_kwargs(headless=True, slow_mo=0):

  1. Return {"headless": headless, "slow_mo": slow_mo}.

Write it in the editor, then press Check answer (Ctrl + Enter).

CLI Setup Commands

bash
# Install Python package:
pip install playwright pytest-playwright

# Install browser binaries:
playwright install

Launch Options in Python

python
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=False, slow_mo=100)
    page = browser.new_page()
    page.goto("https://targetqa.com")
    browser.close()

Key Takeaways & Walkthrough Summary

Installing Playwright for Python takes only two commands. In this lesson, you will install the Python package, download browser binaries with the CLI, configure headed vs headless execution, and run your first test. Let's install Playwright!

Part of the Playwright + Python course (Playwright with Python). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.

Common Doubts & Lesson Q&A

Do I need to install Chrome separately on my machine?

No! 'playwright install' downloads hermetic, dedicated builds of Chromium, Firefox, and WebKit guaranteed to be compatible.

Ready? Solve the task in the editor

Use Check answer to mark it complete. Hints are there if you need them.

Python
Skip