When comparing Selenium vs CasperJS, the Slant community recommends Selenium for most people. In the question“What are the best automated browser testing frameworks?” Selenium is ranked 1st while CasperJS is ranked 7th. The most important reason people chose Selenium is:
The open source community behind Selenium has a very large & engaged developer base. This ensures a stable support channel for the tool. In addition, various companies also provide support for Selenium. This active and multi-channel support provides a much more lucrative option for developers looking to implement Selenium in their workflow.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Actively supported
The open source community behind Selenium has a very large & engaged developer base. This ensures a stable support channel for the tool. In addition, various companies also provide support for Selenium. This active and multi-channel support provides a much more lucrative option for developers looking to implement Selenium in their workflow.
Pro Cross-browser
Supports many browsers and a solid platform for adding future browsers to selenium (WebDriver)
Pro Cross-platform
Selenium is based on Java and can be run on Windows, Mac, Linux, Unix, etc.
Pro Ability to imitate a real user using the application
Testing is analogous to a human being using the web application which is not possible with a solution which runs headless and claims to run faster than Selenium.
Pro Integrates with any CI tool
Selenium, with its ability to interact with different testing frameworks, like NUnit or xUnit, makes it easy to get Selenium working with practically any Continuous Integration services.
Pro Uses an approved WC3 standard - WebDriver
The WebDriver protocol is standardized by the World Wide Web Consortium which makes it easy for third-parties to get involved and contribute to Selenium.
WebDriver has been the foundation of many additional automation projects besides core selenium and has become the de-facto standard for UI automation.
Pro You can use the same IDE you use for coding to debug
Pro Integrates well with existing testing frameworks
Pro Support for many languages
Selenium supports a variety of languages including Java, Python, PHP, C#, Ruby and JavaScript ensuring that the tool is easily accessible to a wide variety of developers.
Pro Use the very minimum amount of code required to run
Selenium tries to inject into the page only the bare minimum of code needed to run the tests.
Pro Easy to set preconditions for the tests
Pro Allows screenshots (either the full page or parts of it) if performing UI testing
There are times where you don't want to open up a browser for screencaps, that is where CasperJS comes to use, it can render the page using its own rendering engine and take and save a screenshot for you, all via the commandline
Pro Easy to understand
Pro Written in JavaScript
Since all webdevs know JS, the start-up time of learning the framework will be reduced to zero, as your team can be productive from day one.
Pro Easily integrates with other applications
Due to the simplicity of the framework, not only other libraries can be built with it, but it can be integrated with any web application as well.
Pro Can run javascript code inside pages being tested
Can execute arbitrary javascript or load external JS into the page being tested. This feature is possible due to the presence of a rendering engine, and helps you see the effects of any client side scripting during your tests.
Cons
Con Requires installation of drivers
Con The IDE for recording isn't too powerful
Con Issues with locators
Locators that support common attributes like: name
, id
, XPATH
, javascriptDOM
, etc. have to be found through firebugs.
Con Not for unit testing but rather UI testing
These are two extremely different concepts. CasperJS should be removed from this list
Con Cannot guarantee 100% accurate Webkit-based browser screenshots
QtWebKit is the rendering engine used by CasperJS. Keep in mind this is NOT the same rendering engine as Chrome; hence, if you want to be 100% sure of the results, you must run a Webkit browser (such as Chrome) yourself.