Playwright vs Selenium Speed Comparison

Selenium WebDriver is slightly faster than Playwright.

Courtney Zhan


Update 2023–01–09: Annotated version by my father.

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

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

Test Setup

  1. Test Machine: iMac (2015, macOS 12.6.2)
    I chose a relatively slow machine purposefully.
  2. Target website:
    This a simple test site created by my father for training purposes.
  3. Execution method
    I developed both versions in TestWise. 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 covers:
    - 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

Test Script

TestWise supports Mocha too, i.e. JavaScript frameworks, such as Playwright. But using Ruby is much more fun!
  • Raw Selenium WebDriver (Ruby) in RSpec syntax framework
it "End-to-End Selenium Raw" do
driver.find_element(:id, "username").send_keys("agileway")
driver.find_element(:id, "password").send_keys("testwise")
driver.find_element(:id, "remember_me").click
driver.find_element(:id, "username").submit
expect(driver.find_element(:tag_name, 'body').text).to include("Signed in")

driver.find_element(:xpath, "//input[@name='tripType' and @value='oneway']").click, "fromPort")).select_by(:text, "Sydney")…