QA · selenium · selenium grid · watir

Watir vs Selenium


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.


10 thoughts on “Watir vs Selenium

    1. Hi Petti,

      Really Happy to see your comment in my blog. I have changed the lines like with your info.

      “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 for each and every browsers. But Selenium does in Single attempt.”

      Thanks for your motivative comment.

  1. FYI, Watir supports IE, Firefox, Safari, and Chrome. It doesn’t do it in the same way with COM objects obviously, but the ruby interface is standardized so that the same tests can be run on multiple browsers easily.

    Also, Selenium RC uses a local proxy to inject the browser-bot code. So installation of code on the server is no longer necessary. It even automatically configures most browsers to use the proxy, and changes it back to normal operation when your testing is done.

    There can be some hiccups with cross-site scripting depending on what you are trying to do.

    Selenium also offers an “IDE” for Firefox that is not unlike the COM approach watir uses for IE.

    But mostly, both products are quite slick, and have come a long way.

  2. Hey! Good article, but Watir can also execute the same test on various browsers, changing only the instance of the browser’s class. For doing so, there is a “generic “browser” class, where it can get instances of any of the various browsers supported by Watir, as Selenium does with the common object “Selenium”.

  3. I disagree on the final paragraph about learning watir… I have learned watir as “watir” without even knowing that Ruby was a language (I know, lol) and because I needed watir I’ve learned Ruby in 1 – 2 weeks, and now that I found a lot of nice stuff in ruby I’m learning even more because testing a web app also demand it.

    1. Hi Jose

      Brief Explanation:
      To cover the automation for entire application,
      1. we may be need to write more scripts.
      a. Each and and test case should be reusable.
      b. We need to implement some external things like screenshot, reporting.

      In this case we should have knowledge about
      Fixnum, String, Array.Hash,Looping concepts,Methods,Classes,Oops concepts,File concept,Ruby libraries(To read tast data from Excel,doc etc).

      Now read my lines again,

      Learning Watir –> Without Ruby knowledge its not possible to write the watir script for one web application.

      Solution : We can learn watir without ruby knowledge but if you want to implement in real time then RUBY is must.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s