Stack OverflowWatir vs Selenium vs Sahi
[+117] [7] Dennis
[2009-03-03 14:22:05]
[ selenium automated-tests watir sahi ]

Out of these 3, which have you or has your company chosen to work with? Pros & Cons please. I'll be comparing them myself as well, but I'd like to hear what others have to say.

Also, please state which you have all tried (so that I know you have a good comparison of the 3).

What's the elaboration of "Pros & Cons" ? - Ripon Al Wasim
(1) I found this constructive. Remind me where we are supposed to look on stackexchange for questions where opinion plays a role in the answer? - user1445967
[+107] [2009-03-13 15:02:20] Dennis [ACCEPTED]

I made a presentation for a seminar I had to hold for our R&D team. Here is basically what I came up with:



  • It’s a Ruby library
  • Multi browser (& OS) support
  • Has a rich API
  • Has a ‘Simple’ class (for non-tech users)
  • Watij & Watin (Java & .NET)


  • Have to learn Ruby (unless you choose Watij or Watin)
  • Every browser requires a different library



  • Multi browser, OS & language support
  • Install server-side or as FF add-on
  • Has its own IDE
  • Record and playback tests


  • Have to learn a vendorscript => Selenese (Unless you write tests in another language which it supports. Then you just have to use the API reference which is straightforward.)



  • Multi browser support
  • Has its own IDE
  • Record and playback tests


  • Confusing interface
  • Least developed/smallest community

There are a lot of other small stuff that I didn't include.

I decided to use Selenium because I like the freedom that you get with all the languages it supports and because development is usually quicker because of its IDE recorder.

Edit Jul 3 '09: I have done some of the same tasks in Watir and they seem to be more stable and straightforward in Watir (written in Ruby) than what I wrote in Selenium (in Java). Selenium has a lot of timing problems but Watir automatically waits for the page to finish loading, and can detect when it's finished loading. Whereas with Selenium, you have to use the pause command (or Thread.sleep() if you use it in Java).

Edit Feb 7 '14: The info presented here is really old and is probably outdated. Also, there exist many more solutions for automated testing in the browser now.

(9) I'd put an asterisk on having to learn Selenese for Selenium. If you're using Selenium RC, all you're doing is consuming the API, which is thoroughly documented and more or less intuitive once you've written a few tests.. - Peter Bernier
(3) No false allegations please. No one from the development team except me. Accept the fact that there are people in the world in favor of Sahi, and they have a right to say it aloud. - Narayan Raman
(2) In the selenium ide I use clickAndWait to wait for the page to load. I generally run my selenium tests on the fastest setting without any pause commands. - Richard Nienaber
Some pause and waitForxxxx commands are necessary when you are testing AJAX enabled sites - Junior Mayhé
(1) Here is a thorough post on Selenium vs Sahi: - Narayan Raman
(1) We just dropped Selenium in exchange to Watir. Lot's of JS errors. Using Watir with Firefox solves our problem. - Tiago Franco
@Dennis - what is your updated opinion (re your edit of Feb '14) - slashdottir
(1) @slashdottir it depends on your needs and language preferences, since most options are good enough now. I most recently used the Python bindings for Selenium, but that's mostly because I enjoy using Python. If you're interested in automated data collection, take a look at this gist I put together which has some options, though it's probably outdated. - Dennis
[+20] [2010-07-10 00:36:11] Jon Rosen

One problem I have found with Selenium is that it is very difficult to test complex multi-site apps. My company has an app that uses a login process via Facebook (using the Facebook API). In Selenium 1.0, which uses Javascript as its enabling engine, the single domain policy is enforced so that when I open my main site ( and then click on the Connect to Facebook button which opens a window in the domain for logging in, my Selenium process loses the connection between the two windows and the app locks up at login. I have tried many different approaches to solve this and have not come up with an answer.

I switched to Watir because it provides an "attach" method which lets me programmatically access both the original domain window and the facebook window from the same test.

Also, as noted by several people, Selenium has timing issues. It is possible to use clickAndWait if a click is known to load a new page, but in our app, there are situations where clicking MAY cause an Ajax call and a dynamic in-page change in which case you do NOT want to clickAndWait (because your test app will hang waiting for a page to load that will never load) or it may cause a page load/reload, in which case NOT waiting is suicide because your app will simply run past the situation and start doing things before the page is fully loaded and ready to go.

If you can't tell which is going to happen (and in our case, you can't without introspecting the javascript which is MUY DIFICIL), you are up the proverbial creek without a paddle.

(Yes, I know, who in the hell would write javascript that does one or the other alternatively depending on certain contexts? I certainly wouldn't have written it that way and I will not defend the implementation of the app, I just have to figure out how to test it LOL!)

Anyway, this is also relatively easy to handle in Watir since you just let it decide whether to wait or not. To be fair, Selenium 2.0 (using WebDriver) will fix some of these problems, but unfortunately, the API will then be different. So its not an easy thing to figure out.

BTW, I was "driving" the Selenium API with Python and it took me about 2 hours to learn enough Ruby to be dangerous LOL and also to use Watir. I have a background in Smalltalk and Objective-C and Ruby comes quite second-naturedly (as did Python). In fact, I expect I am going to end up on the fence, because there are some awesomely nice, robust and symmetric things in Ruby that are much better than Python, but Python also has its pluses. I still think code is cleaner in Python and easier to read for the most part, but as for power (particularly in terms of metaprogramming), I think Ruby is the better engine.


[+10] [2009-03-09 22:48:49] paperhat

I haven't looked into Sahi, but I can tell you why we have recently chosen Selenium RC over watir. It all comes down to programming language. We are a Java shop, and no matter how easy or great Ruby is, it is much easier to coax developers into writing tests if they don't have to change contexts or IDEs. We found functionality to be similar and had a preference for watir's object model, but being able to write Selenium RC tests in Java gave it the edge.

If you are looking at open-source web testing, you should also consider webdriver. It is a good alternative to Selenium RC, and is actually going to become Selenium 2.0 at some point in the future.

I also like the ability to write tests in Java with Selenium RC. I discovered that Watir has a Java portal, it's called Watij. But it's not that great. I have to admit that I like Watir's API more. It's richer than Selenium's. But Watir also gave me a lot more problems than Selenium. - Dennis
[+9] [2009-07-22 21:08:56] Mark Erdmann

I have to agree with Dennis that the pro-Sahi comments are probably from the Sahi team or some other interested party. When we tested Sahi in our shop a few months ago, it performed very poorly in comparison to Selenium. I don't know if it has improved, but at that point in time it was definitely not a usable product.

(1) May be you should re-evaluate Sahi now. Have a look at this video: and compare with other tools. - Narayan Raman
(1) June 2012, I had some major issues working with Sahi, so I can back this answer from 2009. - Lemmings19
(2) I agree, when evaluating different tools on SO there seem to be a lot of one / two answer accounts promoting Sahi. Smells a bit dodgy. - James P McGrath
[+2] [2009-07-20 09:06:07] robyrobot

I'm using Sahi and I think it very powerfull tool for functional testing. My opinions follows:


  • Multi browser support
  • Has its own IDE
  • Record and playback tests
  • Data-driven test via jdbc:odbc bridge (this allows to exploits data file as xls, mdb, csv, and .. every supportend jdbc:odbc driver)
  • active community (fast replies to bugs/problem/suggestions) .. small but active ;-)
  • test success/faillure reporting in html files
  • capabilities to run test using batch file or ant script
  • lightweight and not stress too mutch the host server.


  • documentation needs to be enhanced (probably it needs a community wiki)
  • need to be improved reporting
  • needs more visibility on the web (hope this post could help ;-))

In conclusions a good choice for me ^_^ thanks Narayan


P.S: I tested also watin, selenium (integrated into Visual Studion using C# library).

Is it possible to test Responsive Web Design with Sahi? - Ripon Al Wasim
[+1] [2010-06-06 20:55:50] SoftwareGuy

Just to add another to the realm: We use iMacros because of its good Flash/Ajax testing support:

[+1] [2011-08-09 12:32:09] dasspunk

Over the last year I've tried two of these tools and the clear winner for me was Sahi.

I started with Selenium. I really liked the concept and wanted badly for it to work, as my alternative at the office was QuickTest Pro (absolutely horrible for web work (and arguably any work)). Unfortunately, selenium doesn't support IE, and though it pains me to say, that is a deal breaker for my work. But on top of that, I wasn't able to completely automate much without MANY difficulties; I found Selenium needed a lot of hand holding. I eventually had to admit defeat with Selenium and look elsewhere.

I then found Sahi... which is similar in concept to Selenium but also supported IE (and all browsers) and was able to successfully automate a few things on my first try. I also liked that Sahi's script language was mostly javascript (with "$"s on vars) and that it's built in library handles much of the heavy lifting. It's facility to access objects with _near and _under is genius! It's light weight and agile... perfect for my needs.

The biggest downside of Sahi to me is the controller can be a bit quirky... but once you realize how it works and get used to it, it's not a problem. A small price to pay for the power it gives you. Everything else has just worked.

I would like to see more folks use Sahi as I want it to stay around. I honestly feel it's a better tool than Selenium currently. I hope more people give it a try.