What Is Playwright?
Playwright is a headless browser automation platform, similar in part to Puppeteer. It can target several browsers including Chrome, Safari, Firefox and Edge. Developed and maintained by Microsoft, Playwright is a test automation framework that allows the user to perform comprehensive automated testing directly on major browsers. This tool is designed with multiple features such as an auto-wait option, capturing of test trace, flexibility and perhaps most importantly cross platform and support for several coding languages. Playwright is one of the few test frameworks that can use other languages as well as JavaScript / Typescript. Test cases can be written in .Net, Java, TypeScript and Python, and it runs cross platform on Windows, Mac and Linux.
Playwright Automation Testing
Playwright is open source under the Apache 2.0 license, and has over 40k stars on GitHub, making it one of the most popular test frameworks around.
Advantages of the Tool
Playwright developers frequently release new features making this tool even easier to use. A few of the many advantages are listed below:
- The installation of this test automation framework does not take much time for configuration.
- In relation to the selected coding language used by the tester, the installation steps may vary.
- Playwright supports multiple coding languages such as Java, Python, and so on. Playwright also supports testing on various browsers e.g. Chromium, Webkit, Firefox and Safari
- Whether it is multi-tab or multi-window, Playwright can handle any test scenario. If a test scenario requires the tester to shift between tabs or windows, this automation tool helps them to do this.
- This tool is developer-friendly, providing a lot of debugging options.
Importance of Playwright
- Playwright is one of the few test automations tools that can be used on multiple devices; this helps testers look for scenarios on the desktop as well as mobile platforms.
- This tool is capable of covering various scenarios, while offering support for file downloads, uploads, and native input events.
- Playwright has about 9000+ active users, with more than 60+ releases. The high number of releases demonstrates how the contributors are actively spending their time fixing existing issues and announcing new features.
Setup
Like most testing frameworks, Playwright can be installed and setup with NPM (Node Package Manager), and run with NPX (Node Runner), in which case, tests are written in TypeScript (or JavaScript). It can also be setup and run with C#, Java and Python using the appropriate IDEs and running directly from the local test project or as part of a CI/CD pipeline.
To Sum Up
Playwright is a well-conceptualized test automation framework, which supports performing end to end automated testing across various major browsers, platforms and devices, using C#, JavaScript, Python or Java.
What Is Puppeteer?
Puppeteer was originally created by the Chrome/Google development team, Puppeteer automates Chromium based browser (Chrome, Edge, Brave and even Firefox). It runs in both headless and interactive mode. Headless being the default, it runs the browser emulation without needing to render it to screen.
With a massive 79.8k stars at the time of writing, this is one of the most popular libraries on Github, and is used by many organisations for many purposes ranging from test, to gathering information for several purposes. Adappt used this in 2020 to gather Covid stats from each govt for the World Health Organization.
The real power of Puppeteer is that it will faithfully render pages in the same way as Chrome / Edge, using the very latest release of the Chromium engine and all whilst running in headless mode. This makes it perfect for integration into CI/CD pipelines running on servers without GPUs
Puppeteer can be used for automated browser testing. It is fast and robust and has a ‘clean syntax’ that allows the user to write readable tests.
What Is Selenium?
Selenium is now one of the most popular free (open source) automation tools and automates the browser to perform the many actions that would have previously been done manually. As mentioned, it records; has playback, and highlights errors while testing web apps. It can run multiple scripts across several browsers.
Selenium Test Scripts / Testing can be written in multiple coding/ programming languages, such as C#, Ruby, Scala, Perl, Python, Java, JavaScript, Groovy and more.
It supports various operating systems and works across various browsers (e.g. Firefox, Chrome, IE, Edge, Safari, Opera) and devices.
It is easy to install and provides constant updates. It has multiple simple and easy navigation tools to assist writing test cases without requiring scripts.
What Is Watir?
WATIR is an acronym for Web Application Testing In Ruby and is pronounced the same as the word ‘water’, it is a simple and flexible tool. It is an open-source family of Ruby libraries for automating web browser testing, and the Watir WebDriver (the modern version of the Selenium based Watir API), it drives/supports Internet Explorer, Firefox, Chrome, Opera and Safari browsers. It is a simple and flexible tool and facilitates the writing of automated tests which are easy to both read and maintain.
It interacts with a browser the same way a person or a manual tester would do, in effect it mimics a real person, it logs in, clicks on links, fills in forms, validates text and so on.
It also runs in headless mode (HTMLUnit).