Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Selenium vs. Watir

DZone's Guide to

Selenium vs. Watir

Learn about the features and advantages of these two tools that will help you choose between them for your test automation framework.

· DevOps Zone ·
Free Resource

Download the blueprint that can take a company of any maturity level all the way up to enterprise-scale continuous delivery using a combination of Automic Release Automation, Automic’s 20+ years of business automation experience, and the proven tools and practices the company is already leveraging.

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.

Image title

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.

Language

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:

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).



Watir

Capybara

Selenium

Language Approach

Object oriented

DSL

Object oriented

Original release

2008

2009

2004

Popularity today

Worst

2nd best

Best

Active? Last release

2 weeks ago

1 month ago

2 months ago

Ease of maintaining test cases

1st (uses Selenium under the hood, providing a better API)

Worst (read discussion)

2nd, very similar to Watir

Cucumber Integration

Yes

Yes

Yes

BrowserStack and SauceLabs integration

Yes

Yes

Yes

Page Object pattern

Yes

Yes

Yes

Browsers

Chrome

Firefox

Edge

IE

Safari

Uses different drivers, including Selenium, so I guess that the same browsers are supported.

Firefox latest releases.

IE 7-11

Safari 5.1+

Opera

Chrome

Edge

Headless browsers

Yes

Yes

Yes

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 that 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!

Download the ‘Practical Blueprint to Continuous Delivery’ to learn how Automic Release Automation can help you begin or continue your company’s digital transformation.

Topics:
test automation ,framework ,selenium ,automation platform ,automation testing

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}