DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Automatic Code Transformation With OpenRewrite
  • Maintaining ML Model Accuracy With Automated Drift Detection
  • Cost-Aware Resilience: Implementing Chaos Engineering Without Breaking the Budget
  • GenAI: Running Prototypes Faster Than Wireframes

Trending

  • Beyond ChatGPT, AI Reasoning 2.0: Engineering AI Models With Human-Like Reasoning
  • Testing SingleStore's MCP Server
  • Debugging With Confidence in the Age of Observability-First Systems
  • How to Format Articles for DZone
  1. DZone
  2. Popular
  3. Open Source
  4. Selenium vs. Watir

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.

By 
Federico Toledo user avatar
Federico Toledo
·
Mar. 29, 18 · Opinion
Likes (7)
Comment
Save
Tweet
Share
15.6K Views

Join the DZone community and get the full member experience.

Join For Free

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:

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



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!

Open source

Published at DZone with permission of Federico Toledo, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Automatic Code Transformation With OpenRewrite
  • Maintaining ML Model Accuracy With Automated Drift Detection
  • Cost-Aware Resilience: Implementing Chaos Engineering Without Breaking the Budget
  • GenAI: Running Prototypes Faster Than Wireframes

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: