NOTE: Its not comparison of Watir-webdriver and Selenium-webdriver
We had a 2 different mechanism before webdriver(2009) and this comparison is not useful if you are looking with Webdriver Option 🙂
Watir — Opens browser as a normal way how the user opens it. Selenium — Create object for browser and works with that object in mentioned/particular port.
Watir — Changing registry details(Proxy-http,socks) is very easy. Selenium — Changing registry details(Proxy-http,socks) is not easy work.
Selenium — If your net connection is very slow then Selenium MAY returns error because of waitForPageToLoad exceeds(We can handle it by its not easy for beginneers) and also sleep commads most of the times fails. Watir — Watir waits until the page was fully loaded. We can use sleep commands
Watir is a Ruby library that wraps the COM interface to Internet Explorer. COM is a long-standing Windows-based technology for making libraries accessible to various languages. This allows access to the Document Object Model (DOM) so it doesn’t matter where on the page an object exists, what matters is how you identify it (id, name, title, etc).
Selenium uses a unique mechanism for driving browsers. Selenium’s automation engine is written in JavaScript and runs inside a browser. The engine, called a browser bot, is embedded in a page that accesses the application under test in a separate frame. Because of cross-site scripting, Selenium’s browser bot has to be served from the same site as the application under test – requiring installation on the server.
Selenium supports a command language, called Selenese. Tests can be embedded in an HTML table, which will be read in by the browser bot and then executed.
Both tools run tests directly in a browser, and both do it in a way that allows the browser to be minimized while the tests are running, which means you don’t have to dedicate a machine to running tests.(if you open more tahn 10 browsers tehn may be your machine hangs depends upon hardware)
Watir was designed to be easy to learn, it allows page elements to be identified by index, name, ID, value or adjacent text. Now Watir supports IE, Firefox,chrome,Safari with the help of Firewatir, SafariWatir,chrome Watir. Complaint: Watir is currently limited to IE browsers on Windows, Firewatir supports firefox browsers. So we need to write separate code(or object) for each and every browsers. But Selenium does in Single attempt.
Selenium was designed for breadth of coverage- multiple browsers and platforms. It was expected to be used by the same developers who built the application. Drawback: Selenium requires a server-side installation.
You can also express Selenium tests in a programming language, taking advantage of language-specific drivers that communicate in Selenese to the browser bot.
Learning Watir –> Without Ruby knowledge its not possible to write the watir script for one web application.
Learning Selenium –> Programming skill is not Major. But the QA should familiar with anyone of the language from Ruby/Java/perl/Puthon/c#/Groovy/PHP to implement the code for any web application.