Skip to main content

Playwright vs Selenium

Today, we will discuss two open-source tools, Playwright from Microsoft, the newest addition to Automation Framework. And another one is the most preferred tool, Selenium, which has been with us for more than a decade now. 

Criteria Playwright Selenium
Browser Support Playwright supports three browser engines: Chromium, Firefox, and WebKit. Chromium includes the browsers Opera, Chrome, and Edge. Gecko Driver supports Firefox and Webkit is behind Apple Safari.

Selenium has the support of Chrome, Firefox, Opera, Edge, and IE. Selenium has the extra browser support IE, whereas Microsoft abandoned this in playwright.

Supported Languages Playwright supports Java, Python, .Net C# and JavaScript. Selenium supports all languages supported by Playwright like Java, Python, .Net C#, and JavaScript, and it has support for three additional languages, including RubyPHP, and Perl.
Handling Web Elements The Playwright's philosophy and technique of handling alerts, iframe, and elements are different than Selenium. Selenium has different WebDriver protocols and architecture to handle DOM elements.
Assertions Playwright uses Expect library from JEST for assertions. Selenium uses third-party libraries like Hamcrest, TestNG, and JUnit.
Test Framework The Playwright supports Mocha, Jest, Jasmine, and AVA. Selenium supports Mocha, Jest, Jasmine, WebDriver IO, Protractor, TestNG, JUnit, and NUnit.
Architecture Playwright has a Headless browser with event-driven architecture. Selenium has layers architecture based on JSON wire protocol.
Community Support The Playwright is new to the field, and community support is pretty limited compared to Selenium. Selenium provides unlimited support for its users via theSelenium ecosystem and self-support documents.
Real Devices The Playwright has experimental support for devices but supports emulators. Selenium supports real device clouds and remote servers.
Prerequisites Need NodeJS to be in fully functional mode. Selenium requires a standalone selenium server or Client Language Bindings, and browser drivers.
OS Support You can execute your Playwright test on Windows, Linux, and Mac platforms. Apart from Windows, Linux, and Mac, Selenium supports Solaris.
Auto Waits The Playwright does various actionability checks on elements before performing specific actions, which makes the execution of the tests much more stable. In Selenium, we use different types of waits, like implicit and explicit waits..
Speed of Script Execution Script execution in Playwright is faster compared to Selenium. Selenium is comparatively slower because the driver serves as a middleman who translates the test script commands and sends them to the browser for execution.

Conclusion

Selenium is a well-established tool with great community and Language Support. On the other hand, Playwright is a new tool with less documentation which is comparatively faster and suitable for complex JavaScript applications. The Playwright is coming up with many features, but it is too early to say that it is an alternative to Selenium.

Video Tutorial: Playwright vs Selenium | What are the differences

Tags
Submitted by arilio666 on April 18, 2022

Ashwin is working with iVagus as a Technical Lead. He has experience in various technologies like Cypress, JavaScript, TypeScript, Rest Assured, Selenium, Cucumber, and Java.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.