Microsoft: Playwright for Python lets you test web apps in all major browsers

Microsoft announced Playwright, a tool that lets developers write tests in Python for web apps on 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 library is available in preview and is designed to help speed up the process of testing web applications on Windows, Linux, and macOS. It can also be used to emulate smartphones with different screen sizes, time zones and web permissions to test web application in mobile web browsers.

SEE: Recruitment Kit: Python Developer (TechRepublic Premium)

It provides a set of application programming interfaces (APIs) to automate browsers that use Chromium, Firefox, and WebKit browser engines. Using the Playwright API, developers can write Python code to create new browser pages, access URLs, and interact with page elements.

“With the Playwright API, you can create end-to-end tests that run on all modern web browsers. Playwright offers faster, more reliable, and better performing automation than existing testing tools,” says Arjun Attam , program manager for Playwright. .

“End-to-end automated testing has become more important than ever. Teams are shipping faster and building apps that run on a growing set of devices. This increase in speed and web targets is putting immense pressure on the testing process, and automation is critical.”

While currently Playwright only supports mobile emulation from a desktop browser, there is an open issue on Microsoft’s GitHub page for Playwright that users can vote to bring testing support to actual mobile browsers.

Playwright integrates with the pytest testing framework and can be used for testing views in Django web applications as well as using Django’s built-in testing tools.

Playwright’s version for Python is in its early stages and builds on the easier release this year of Playwright for JavaScript and Microsoft’s TypeScript JavaScript superset as a Node.js library. It has the same purpose as Playwright for Python, but allows writing test routines in JavaScript.

SEE: Programming languages: Julia users most likely to switch to Python for data science

Especially for automated testing, Playwright expects the web application’s UI to be ready to handle testing actions like clicking a button, which must be there before its functionality can be tested. It can also be used to automate web application connection testing on a login form.

“Under the hood, Playwright uses an event-driven architecture that can listen for precise browser events such as DOM changes, network requests, and page navigations,” Attam notes.

Playwright also provides standard interfaces to monitor and modify network traffic for testing tasks such as managing attachments downloaded by a page and network response after a user clicks a button.

Learn more about Python and programming languages

  • Python programming language: Here’s what’s new in version 3.9 RC2
  • Python programming: Microsoft’s latest beginners course delves into development for NASA projects
  • Popularity of programming languages: Python overtakes Java – as Rust hits top 20
  • Top Programming Languages: Python Still Reigns, But Old Cobol Takes a Pandemic Shock
  • Kotlin programming language: how Google uses it to eliminate code bugs that cause most crashes
  • Microsoft: we are unplugging Windows builds from the PHP programming language
  • Kotlin programming language: Google offers a free course for Android development
  • Programming languages: now the Rust project is looking for a way to access the Linux kernel
  • Ranking of programming languages: R is making a comeback but there is debate on its rise
  • Programming languages: Julia touts her speed advantage over Python and R
  • Microsoft Principal Engineer: TypeScript programming language took off thanks to Google’s Angular
  • Eich, Creator of JavaScript: My Take on 20 Years of the World’s Best Programming Language
  • Programming languages: Java still reigns over Python and JavaScript as the main language
  • Julia programming language: users reveal what they love and hate the most
  • Mozilla is funding a way to support Julia in Firefox
  • MIT: We’re leveraging the Julia programming language to open up AI coding to novices
  • Programming languages: Developers reveal what they love and hate, and what pays off the most
  • Programming languages: Rust enters the top 20 popularity rankings for the first time
  • Microsoft: Here’s why we love the Rust programming language and launched Project Verona
  • Microsoft: Bosque is a new programming language designed for AI in the cloud
  • Programming languages: Python apps could soon run on Android
  • Is Julia the next big programming language? MIT thinks so, as version 1.0 lands TechRepublic
  • Mozilla’s radical open source movement helped rewrite the rules of technology CNET
  • Comments are closed.