Selenium vs Watir
Choosing between these two test automation tools for an automation framework
I recently got started on a client project in which I’m putting together an automation framework, where, luckily, I’ve been given some objectives that are quite clear to fulfill. I want to discuss one of the things that I am considering in regards to the project (in case anyone has some helpful insights!) which is: What automation tool should I use? In the ring, I have Selenium vs Watir.
On the one hand, Selenium seems to me the most natural option, the most popular open source tool for web browser automation. The de facto standard. But, when I was discussing it with my colleagues at Abstracta, they recommended Watir, which is better for Ruby.
So, I started to investigate a little more. Before I start comparing the two tools, I would like to comment on why this particular language choice.
If it were for me, I would program in Java, since that is what I have more experience in, but the client’s team programs in Ruby. But, that’s okay, I can be flexible! Since I hope that the developers consider automation as a value-add to them in the future which they can extend, maintain, improve, utilize, etc., I prefer to stick with Ruby. Even though with automation, when taking a black box approach, the language used for the system code is less important. Anyway, this argument isn’t a minor one— as testers, we should always seek to team up with developers, and not go in a separate direction from them with our technological stack.
We’re all on the same team, right?
Automation Tool: Selenium vs Watir
I started to investigate a bit, focusing on open source web browser automation tools for Ruby that integrate with:
- Cucumber (when thinking about BDD)
- BrowserStack or SauceLabs for cross-browser testing,
- Applitools for visual testing
Here’s a small comparison chart. I also threw Capybara into the ring (but for my purposes, it had much less fighting power than the others).
|Language Approach||Object oriented||DSL||Object oriented|
|Active? Last release||2 weeks ago||1 month ago||2 month ago|
|Ease of maintaining test cases||1st (uses Selenium under the hood, providing a better API)||Worst (read discussion)||2nd|
|BrowserStack and SauceLabs integration||Yes||Yes||Yes|
|Page Object pattern||Yes||Yes||Yes|
|Uses different drivers, including Selenium||Firefox latest releases.|
Internet Explorer 7-11.
Safari 5.1+Opera ChromeEdge
|Locators||Id, Name, CSS selectors, XPath||Id, Name, CSS selectors, XPath||Id, Name, CSS selectors, XPath|
My conclusion, for now, is that there aren’t any big differences between Selenium and Watir. While I started out wanting to go with Watir, there are other factors that make me think about switching to Selenium:
- Better support (a greater community implies more forums, more resources, examples, problems solved).
- It’s more likely you’ll find someone with experience in Selenium than in Watir (although knowing one, it doesn’t take long to learn the other).
- It’s more popular and more accepted. Every time I tell someone that I’m going to use Watir, I end up saying, “It’s something similar to Selenium.” Why not just use Selenium?
- The reason why someone recommended Watir to me is because it has an API that makes it easier to read, I am not convinced that it really does make it much easier.
So, for now I am choosing Selenium…
What would you do if faced with having to choose between Selenium or Watir? Leave me a comment below!
Recommended for You
Read the Ultimate Guide to Continuous Testing
- Our Strength Lies in our Diversity
- Abstracta is recognized with the award “Talent has no Gender” for its work towards gender equality.
- GoodFirms: Abstracta CEO Steers the Company Towards Its Vision to Co-Create World-Class Solutions, Improving People’s Quality of Life
- An End-to-End Guide of Load Testing
- Quality Sense Podcast: Ash Coleman – Diversity, Equity, and Inclusion at Work