Playwright for Python automates end-to-end testing for web apps and works in any browser.
Microsoft has announced Playwright for Python, an API that enables developers to write end-to-end tests for web applications in the
Playwright for Python is designed to speed up the process of testing new web applications by automating the process from start to finish. Built on the
the Playwright API allows developers to run tests on all modern web browsers, including the new Microsoft Edge browser, Chrome, Mozilla Firefox and Safari.
in the world.
SEE: Linux commands for user management (TechRepublic Premium)
According to the company, the Playwright API delivers automation that is faster and more reliable than existing testing tools, allowing developers to launch new, feature-rich web apps at greater speed.
“Automated end-to-end tests have become more important than ever before,” the company said in a blog post.
“Teams are shipping faster and building apps that run on a growing set of devices. This increase in velocity and web targets puts immense pressure on the testing process, and automation is critical.
While automated testing systems already exist, these can be laborious and unreliable. At the same time, automated testing can be interrupted by time-out events, leading to failures.
SEE: Top 5 programming languages for systems admins to learn (free PDF) (TechRepublic)
To counter this problem, Playwright automatically waits for the user interface (UI) to be ready, which ensures tests are more reliable to execute and easier to author. The API uses an event-driven architecture that can listen to browser events such as DOM changes, network requests and page navigations. Meanwhile, Playwright scripts can intercept and modify network activity and automate scenarios across multiple web pages.
Playwright can be used to test views in Django-based web apps. Developers can use the ‘Live Server Test Case’ class to launch a live Django server and run browser tests, Microsoft said.
A Playwright plugin for the pytest framework is also available. Developers can additionally deploy Playwright tests to their GitHub CI/CD with the Playwright GitHub Action, or with tools for other CI/CD providers.