Playwright vs Selenium Speed Comparison

Selenium WebDriver is slightly faster than Playwright.

Zhimin Zhan
10 min readJan 8

--

A repost of my daughter’s article with permission. I added a few notes.

In the previous article, I compared the syntax of Playwright and Selenium WebDriver. One feedback I have heard is that “Selenium is slower”, I disagree. Both are fast in terms of test execution, from my experience.

Today, I did a quick benchmark to verify the timing difference.

Table of Contents:
· Test Setup
·
Test Script
·
Benchmark Results (raw)
·
Refactored Versions
Benchmark Results (POM)
·
Findings
Why I did not include Cypress?
·
Zhimin’s notes
The language factor is minor, in terms of test execution speed

Test Setup

  1. Test Machine: iMac (2015 model, macOS 12.6.2)
    I chose a relatively slow machine purposefully.
  2. Target website: https://travel.agileway.net
    This a simple test site created by my father for training purposes.
  3. Execution method
    I developed both versions in TestWise IDE. To remove any factors, I timed and ran them both from the command line.
  4. Framework versions
    - Selenium WebDriver: 4.7.1 (Ruby 3.0.2)
    - Playwright 1.18.1 (Node v18.10)
  5. Browser versions
    - Chrome: 108.0.5359.124 (Official Build)
    - Playwright’s Chromium: 99.0.4812.0 (Developer Build)
  6. Test Scenarios
    24 test steps cover:
    - Launching and Closing the Chrome/Chromium browser
    - Various control types, such as Link, Text Field, Checkbox, Radio, Select List, and Button
    - Different locators, such as ID, Name, Tag, Attribute, CSS and XPath.
    - Assertion

Zhimin: Some framework/tool vendors release dubious benchmark test results, with specially optimized web pages. That is fraud. The site used for this benchmark testing just contains several simple generic web pages, good for testing raw execution speed.

Test Script

--

--

Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer. Help teams succeed with Agile/DevOps by implementing real Continuous Testing.