Why Raw Selenium Syntax is Better than Cypress and Playwright? Part 1: WebDriver is a W3C Standard and its Success is well Established
Selenium WebDriver is the best web test automation framework, with good reasons. I list some undisputable facts to support that.
Update 2023–06–29: Part 2: The Audience Matters is available.
Update 2023–07–05: Part 3: Selenium is Accurate, Intuitive, Consistent, and Geniously Designed is available.
Cypress and Playwright testers won’t like the article's title. Let me firstly crush these people’s thoughts first with a simple fact:
Raw Selenium WebDriver syntax is defined by W3C experts after many rounds of refinement; Cypress or others are created by some individuals with a certain level of commercial interests.
Some would disagree with my article title (this fact, i.e., commercial interests, does not necessarily mean good or bad), I know, but accept this fact first. This article will show more facts, please be open-minded. Some of you might have read my other two specific comparison articles:
Here, I will share views from higher perspectives that people are usually unaware of (but might sound well-organized), such as:
a long history of failures in JS test automation frameworks
locked in the JavaScript world, there is a much better scripting language for test automation. (such as Ruby, suggested by the classic Agile Testing book)
the real success stories of using Selenium WebDriver
the shorter test statement syntax does not really make test scripts better, the DSL layer is.
not knowing WebDriver is a W3C standard, the W3C process
I will explain the benefit of WebDriver syntax (over Cypress and Playwright) and why this syntax is good in real successful test automation in Part 2 and Part 3.
Table of Contents:
· There is no winner in language debating, let’s talk about the facts.
∘ 1. W3C HTML standard is a success
∘ 2. W3C’s Reputation and its process is respectable
∘ 3. All Major Browser vendors support the WebDriver standard
· Many People Used Selenium Wrongly
∘ 1. Protractor.js is supposed to be a syntax improvement over Selenium, the result: Deprecated.
∘ 2. Badly-implemented new test automation framework on top of Selenium
∘ 3. Selenium Steps are NOT meant at the top level
∘ 4. Selenium Sytnax are good at it should be
There is no winner in language debating, let’s talk about the facts.
I worked front-end and back-end when I was contracting (as a senior Java Developer) between 2000–2010. I was quite open to using JavaScript on client-side work. But at that time, many back-end developers (so-called EJB developers) looked down on JavaScript, saying it was not a proper programming language, a patched-up one.
Now JavaScript has become a main coding and testing language. I am still coding JS quite extensively in all my web apps, such as ClinicWise, WhenWise and TestWisely. Long-time readers know I am against using JavaScript for test automation. For over 12 years, I haven’t met a single JS tester who could do real test automation (self-assess against the AgileWay Continuous Testing Grading), i.e. all objectively FAKE. Of course, it does not mean every JS developer, only the ones I met (despite whatever they bragged, however, when I asked for evidence of test executions, such as months of test execution reports, …)
By the way, Educative published my course: Selenium WebDriver Recipes in Node.js based on my eBook. I shared my history with JavaScript here to show that I am not prejudiced against JS (on the contrary, most JS testers are prejudiced. For example, how many have used Java or Ruby, besides JS, scripting automated testers for years?). In this article, I will just focus on the facts that logical people will agree with. Reminder, testers should be objective and speak with results.
1. W3C HTML standard is a success
When HTML was out (over two decades ago), there was plenty of criticism, such as not being well-formed.
<br>
<img src="...">
The later XHTML complimented that.
What would have happened if started with XHTML (a form of XML)? We don’t know. When I was working in the W3C Australia Office between 1997–2000, one of our job was to promote XML, which took some effort and time.
Some programmers would have remembered the XML schema leading to complex stuff, such as SOAP and XML Schema Objects.
Objectively speaking, W3C HTML was a huge success, and so was CSS, these define the web. WebDriver is the W3C’s standard to automate web.
2. W3C’s Reputation and its process is respectable
After HTML, several W3C standards, such as CSS and XML, had a huge impact on the software industry. I know quite a bit W3C process, and while it is slow, the quality of the outcome is generally well-thought.
At the WWW7 conference (in Brisbane, my city), I remember the keynote speech by Sir Tim Berners Lee (the father of WWW and director of W3C), “forward compatibility”. What a vision! a true genius! (the world thanks to Sir Tim).
One die-hard Cypress fan might argue that “the ‘geniuses’ in the Cypress team are better than Sir Tim and the W3C team”. I won’t waste time debating that. Let’s see some facts about Cypress:
Cypress was released without supporting frames and other limitations.
These are listed on its website. Come on, it is simply irresponsible to call it a test automation framework/tool! (used to verify others)Lies
Many benchmarks show that Cypress is slower than Selenium and Playwright.
3. All Major Browser vendors support the WebDriver standard
Apple, Google, Mozilla and Microsoft all support WebDriver. For web test automation, automated test execution has a strong dependency on the browser. As a web test automation engineer, I think this is huge, don’t you think?
All articles, which sing for proprietary test automation frameworks, seemed deliberately neglect this important factor. Just with a little bit of imagination, if Google introduces a new feature (for web browsing) to Chrome, it will communicate with W3C and almost certainly will cover the testing capability via its own ChromeDriver. Will Google (and other browser vendors) care about Cypress or others, of course NOT!
Many People Used Selenium Wrongly
It is true that many test automation attempts with Selenium failed, due to incompetence. Many shifted the blame to the framework. Oh well, since that, attempts with the following automation frameworks, such as Protractor.js, Test Cafe, Pupettere, Cypress and Playwright, pretty much all failed(Check out the Definition of End-to-End Test Automation Success). Now blame what? Maybe should self-check.
Keep reading with a 7-day free trial
Subscribe to AgileWay’s Test Automation & Continuous Testing Blog to keep reading this post and get 7 days of free access to the full post archives.