Serdar Yegulalp
Senior Writer

Microsoft’s Playwright simplifies tests for Python web apps

news
Sep 30, 20202 mins

Front-end tests for web apps have traditionally been a chore. Playwright offers an easier way to integrate those tests for Python.

straight vs. tangled path
Credit: Thinkstock

Microsoft today announced the release of the Python version of Playwright, a framework for end-to-end testing of web applications in Python. Playwright is the latest in a slew of Microsoft-created Python tools including the Pylance and Pyright language-support add-ons for Visual Studio Code.

Playwright integrates with the Pytest framework in Python, a widely used automated testing system for Python apps. It provides high-level primitives for accessing elements and behaviors on web pages, so that, for instance, the contents or attributes of elements on a page can be checked. Playwright also integrates with the testing framework in Python’s Django web framework, so that existing Django tests can be extended with front-end tests.

Front-end testing web frameworks has typically been a chore. In Python’s case, one might use a framework like Selenium to automate the interaction of a browser with the web framework and check the results. Playwright simplifies the process: In addition to providing high-level interaction primitives (page.goto(), or page.click()), Playwright intelligently waits for browser activities to complete before performing actions, so the developer doesn’t have to account for that.

Playwright supports interactions under all three major web browser systems (Chromium, Firefox, and WebKit), and device emulation as well. Copies of each web engine come packaged with Playwright, so there is no need to download or install the browsers on the system at large. It’s also possible to emulate web-specific technologies like geolocation, for instance by specifying a latitude and a longitude in a page test. Network traffic can be logged and modified.

Playwright is still in the early stages, but can be installed from the Python Package Index with pip install playwright.

Serdar Yegulalp

Serdar Yegulalp is a senior writer at InfoWorld. A veteran technology journalist, Serdar has been writing about computers, operating systems, databases, programming, and other information technology topics for 30 years. Before joining InfoWorld in 2013, Serdar wrote for Windows Magazine, InformationWeek, Byte, and a slew of other publications. At InfoWorld, Serdar has covered software development, devops, containerization, machine learning, and artificial intelligence, winning several B2B journalism awards including a 2024 Neal Award and a 2025 Azbee Award for best instructional content and best how-to article, respectively. He currently focuses on software development tools and technologies and major programming languages including Python, Rust, Go, Zig, and Wasm. Tune into his weekly Dev with Serdar videos for programming tips and techniques and close looks at programming libraries and tools.

More from this author