The world of test automation is expanding every day, new tools are getting added and some tools are disappearing. It’s difficult to choose good tools just by reading their documentation. We are helping the organization to choose the best tools by providing the pros and cons of Cypress and Selenium
What is Cypress?
What is Selenium?
Every tool has its advantages and disadvantages likewise Selenium and Cypress as well. Comparing Cypress and Selenium helps to choose the best tool for your organization as per your requirement and scope.
Cypress Test Automation Tool
The Cypress supports multiple types of testing such as
- Unit Testing
- Integration Testing
- API Testing
- End to Testing
Cypress mainly focuses on Test Driven Development which is popular in the modern world Software Development Process.
Advantages of Cypress
Easy to set up: Cypress is a framework-ready tool which means, the framework is already set up for you, One can download and install the Cypress on his machine and start writing scripts.
Automatic Waits: Cypress implemented an automatic wait technique inside their code, It waits for a specific element to load and to be ready before performing any actions.
Cross Browser Testing: Cypress supports multiple browsers such as chrome, edge, electron Firefox, etc.
Rich debugging feature: Cypress provides multiple ways to debug using logs, dev tools, and dedicated commands for debug
Screen Snapshots: Cypress takes a screen capture of every step, which helps to navigate back to previous steps and know the status, and analyze them.
Network Control: Network traffic control feature helps to test edge case scenarios without server involvement. Cypress provides a way to control Network Traffic.
Feature of Spies, Stubs, and Clocks: Cypress provides a feature to verify server response, the behavior of functions and control them with your scripts.
Cypress Window: Unlike other automation tools, Cypress window will be loaded as soon as you start the execution which helps you to run selection-based tests and improves the debugging feature.
Support and Documentation: Cypress documented everything clearly on their website. However, needs some improvement to understand the beginner. Community support is good for Cypress.
Dashboard Feature: Cypress does have a Cypress Dashboard feature, where it will show different types of reports, charts, etc. Cypress Dashboard is sold as a commercial solution that means the organization needs to pay for Cypress Dashboard to adapt it.
Disadvantage of Cypress
Cypress also has multiple cons; this may be due to architecture limitations or features they might not have implemented yet. Below is the list of Cypress Cons
Cross-Domain Limitation: Cypress tests don’t allow multiple domains, for example, if you are using Microsoft Login for your website (online.mircosft.com) and your website URL is (example.com), Now, if you call example.com which may redirect to online.micorsoft.com for login that is a different domain altogether, this use case is not supported in Cypress. Cypress suggests not automating a website as third party websites are not managed by you. You might need to look for a workaround for Cross-Domain related scenarios.
Multiple tabs and windows not supported: There is no direct support for multiple tabs and windows, at any point in time your test cases should run on a single-window/tab. If there are any such scenarios you need to use the workaround.
No Support for Safari: Cypress still doesn’t support Apple Safari yet. If your application user base is focused on Mac machines, then this limitation might lead to think twice.
Plugins Dependency: Many important features such as XPath, Reporters, etc. are supported as additional plugins, you might end up adding more and more third-party plugins. Since third party plugins are managed by individual contributors, the dependency might be blocker for your framework in future.
Cypress is Limited to Single Instance: Cypress restricts you to use multiple sessions of browsers, in turn, your tests can’t be executed in multiple browser sessions.
Selenium Test Automation Tool
Though there are many new tools entered into the market, Selenium is still having its market share, The obvious reason is, it has a rich set of features, timely updates, and a high level of customization. Selenium Webdriver provides a choice for testers to choose their programming language like Java, C#, python, etc. it never restricts them. Unlike Cypress, Selenium is not a ready framework it requires some setup. Selenium allows you to create your own set of framework and functionality however you want.
Advantages of Selenium
Cross Browser Support: Selenium doesn’t restrict you on browser type. You can seamlessly run your tests across all major browsers Chrome, Safari, Edge, Firefox.
Parallel Executions: Selenium allows you to execute your tests parallelly on multiple instances of browsers which speeds up your test execution.
Testing Framework: Testing Framework options are available based on the programming language you choose, there are a lot.
Automate the way you want: Selenium doesn’t restrict you in terms of domain, Iframe, multiple windows, etc. you can automate the way you want.
Plugins and Add On: As the Selenium userbase is more, many users, organizations have created custom plugins that can be hooked into your framework as well.
Documentation: Selenium has documented many things but beginners might feel difficulty in finding the right documentation. However, there are many tutorials out there that help testers.
Community Support: Selenium user base is high so we can expect high community support, most of your questions are already answered on various forums.
Disadvantages of Selenium:
Selenium Setup: Unlike Cypress, Selenium is not bundled everything, if one wants to build a solid testing framework he has to download and install many things and has to set up on his own.
Waits: One needs to provide explicit and implicit waits for elements; however one can build automatic wait functionality on his own but it’s not built-in.
Results/Reporting: Selenium is shipped as a pure format, it doesn’t add on any reporters user needs to customize them using available options.
Screenshots: Like Cypress takes screenshots for each step, selenium just executes the tests you need to configure screenshots features which is time-consuming and difficult for beginners.
Debuggability: The debuggability depends on the programming languages you use for selenium, Usually IDE’s and programming languages provide debugging features for selenium.
Interactive Window: Unlike Cypress, Selenium by default doesn’t provide any interactive window, this is left to your IDE’s and it’s configuration.
Cypress and Selenium Similarities
Add on Support
End to End Automation
Cypress and Selenium Difference at a glance
Programming Language Support
Requires some effort to build the framework
Chrome, Edge, Electron, Firefox
Chrome, Edge, Firefox, Safari
Only one browser session at a time
Supports parallel execution
Multiple Window Support
Test Assertions Libraries
Depends on Programming Language
Default Reporter is Spec, Customizable for other supported reporters
Yes provides rich features for debugging
Selenium framework mostly relies on IDE for debugging features.
Provided as Premium/Paid Feature
Very Good as the user base is more.
Built-in Screenshot feature
No built-in screenshot feature. Customization is required to add this feature.
Apache License 2.0
Cypress and Selenium both are good tools, In comparison with Selenium, Cypress is shipped with everything bundled inside, the Selenium comes in pure flavor because of this selenium allows you to customize the way you want. The requirement and scope of automation might differ from organization to organization, The Cypress vs Selenium comparison makes it easier for you to decide the tool which is best suited for your organization's need. Every tool has its pros and cons. Cypress and Selenium are no exceptions for that. However, the limitation should not be a road blocker in future. The comparison of tools and conducting Proof Of Concept (POC) is very important before choosing the right tool.
As we know technology is changing every day, it is important to adopt new technologies to keep ahead of the competition. Rahul Shetty Academy is helping the organization to upskill their employees which helps the organization to improve productivity and become the best in the industry.
People love Rahul Shetty Academy on Udemy since the topics and tools are covered considering beginner to the expert level in-depth and in detail, we are thankful to all. If you have still not explored our Udemy courses, it’s worth giving try. Rahul Shetty academy always focused towards providing best learning experience with lowest possible cost. Explore the courses on Rahul Shetty Academy.