Cypress vs. Selenium: What testing tool is right for you?

Getting started with Selenium and Cypress 

Selenium

Software Requirements for installing Selenium-

Java SDK, Eclipse IDE, Selenium Java Client driver,

WebDrivers (CromeDriver for chrome, Mozilla GeckoDriver for Firefox, etc.)

Writing your first test

This test code will open the chrome browser and navigate to http://google.com/ and search for the keyword “Selenium Rocks!”

cypress-blog-image

Cypress

Software Requirements for installing Cypress-

Node.js, Visual Studio Code

Run the following commands to starts with Cypress:

npm install cypress –save-dev

npx cypress open

Writing Your First Test

This test code will open the chrome browser and navigate to http://google.com/ and search for the keyword “Cypress Rocks!”

blog-cypress-image

Both tools can be easily installed. Cypress is simpler and there is no overhead of driver or IDE.

Language Support

Selenium

Selenium supports a wide range of programming languages using the drivers specific to each programming language. Some of the supported programming languages – Java, Python, C#, JavaScript Etc.

Cypress: It’s JavaScript Only!

Any programming language can be compiled down to JavaScript, but the test cases ultimately run inside the browser. Therefore, Cypress uses the JavaScript library only, there is no binding of drivers like in Selenium.

Wait, what?

Selenium has a large number of language supports than Cypress, does it mean Selenium is more Developer-friendly?

Selenium is a pure automation tool for testing purposes, it is not built for development purposes.

On the other hand, Cypress is built for both Developers and QA Engineers. Cypress is less of a  replacement for Selenium and more of a way to introduce developers to test automation.