Microsoft has announced Playwright, a tool that lets developers write tests in Python for web applications across Chrome, Chromium-based Edge, Apple Safari and Mozilla Firefox.
Playwright, a Python library, allows developers to essentially control the browser with a few lines of Python code to automate cross-browser testing for single-page web apps and Progressive Web Apps.
The Playwright for Python[1] library is available in preview and is designed to help accelerate the process of testing web applications across Windows, Linux and macOS. It can also be used to emulate smartphones with different screen sizes, timezones, and web permissions to test a web app in mobile web browsers.
SEE: Hiring Kit: Python developer[2] (TechRepublic Premium)
It provides a set of application programming interfaces (APIs) to automate browsers that use the Chromium, Firefox and WebKit browser engines. Using the Playwright API, developers can write Python code to create new browser pages, navigate to URLs and interact with elements on a page.
"With the Playwright API, you can author end-to-end tests that run on all modern web browsers. Playwright delivers automation that is faster, more reliable and more capable than existing testing tools," says Arjun Attam, a program manager for Playwright[3].
"Automated end-to-end tests have become more important than ever before. 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 presently Playwright only supports mobile emulation from a desktop browser, there is an open issue on Microsoft's GitHub page for Playwright[4] that users can upvote to bring support for testing on actual mobile browsers.
Playwright integrates with the pytest testing framework and