When comparing Watir vs Selenium, the Slant community recommends Selenium for most people. In the question“What are the best test automation tools for web apps?” Selenium is ranked 1st while Watir is ranked 2nd. The most important reason people chose Selenium is:
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.
Ranked in these QuestionsQuestion Ranking
Pro Free and open source
Watir is free and open source, released under the BSD license.
Pro Easy to learn for Ruby developers
Since the test scripts are written in ruby, it is easy to learn, especially for ruby developers.
Watir webdriver is built on top of the WebDriver framework which can drive the most popular frameworks out there, making Watir perfectly usable with multiple browsers.
Pro Easy to create and maintain web tests
Since the ruby language is highly concise, the tests created using Waitr are very easy to create & update. Thus the long term maintenance of the test suits consumes less overhead.
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 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 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 Support for many languages
Selenium is based on Java and can be run on Windows, Mac, Linux, Unix, etc.
Supports many browsers and a solid platform for adding future browsers to selenium (WebDriver)
Pro Integrates well with existing testing frameworks
Pro You can use the same IDE you use for coding to debug
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 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
Con Ruby only
Watir only uses Ruby as it's scripting language, so if you want to use another language other than Ruby or if you are not comfortable enough with it, it would be best to avoid Watir.
Con Harder to jump to any other library that exposes the Selenium API
Watir introduces its own API which differs from the underlying selenium-webdriver. That means jumping to any other library which exposes the selenium-webdriver API such as Appium becomes harder as paradigms can't be transferred between the two.
Con The IDE for recording isn't too powerful
Con Issues with locators
Locators that support common attributes like: