Playwright vs Selenium WebDriver Syntax Comparison by Example

Raw Selenium WebDriver with Ruby Binding is much better.

Zhimin Zhan
9 min readDec 25, 2022

--

Zhimin: A repost of my daughter’s article with permission. I added a few notes. Many test automation engineers (most of them are fake) say, “The new Playwright is better than Selenium”. They often quote one or two non-essential tool features (e.g. waiting), rather than focusing on the framework and test script, which really matters when doing real E2E test automation.

In my intern role early this year, I developed a set of automated test scripts. To be exact, 29 test cases, running reliably on a daily basis. My colleagues and managers were impressed.

I started with Selenium WebDriver with Rspec first. Later, I was told to use Playwright by the department’s test automation guru (of a large telecom company). As a 20-year-old fresh-out-of-Uni intern, of course, I listened. I did the Selenium Ruby version for new test scenarios first (much easier) and then converted it to Playwright. I also set up two build projects in the BuildWise CT server to run both versions daily.

This article will show the syntax difference between Playwright and Selenium, using a simple test case (login test) as an example.

--

--

Zhimin Zhan

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