Wednesday, April 15, 2015

Selenium vs Watin using .Net C#

There are many other posts on this topic, but in the end reader has to make decision to which one to use. Both libraries are developed for test automation and have cons and pros to discuss. We will take a look into this matter from view of Scraping. As I have never used them for testing purposes.

I will just list what I experienced with both libraries, and then try to make a point. Lets start with Watin project.

Watin Cons

  • You can start here to learn something on Watin. Not updated since some serious time so you have to dig into Google.
  • Has support for IE only. (They supported Firefox v4 or something so it is not stable to run)
  • IE works fine on version 9. But Version 9 Support ended on Windows 8 machines. So you have to use IE 11 with Watin. This usage causes some undetermined states with program. E.g. if you touch IE11 window while watin is still managing it, then watin will lose control over it. 
  • Again IE 9 may deprecate soon, so not a good thing to rely on.
  • You can easily apply proxy on Watin, since you have to change Internet Options, which is very tricky.
Watin Pros
  • Watin controls IE in a native way, so its performance is much better than Selenium IE version. 
  • IE 9 does not crash easily, and you can run may simultaneous windows. 
Selenium Cons
  • Uses WebDriver to control browsers, which adds another layer so it is performance is slower than Watin.
  • Native Firefox webdriver sometimes crashes, and it does not have a solution. It says "Directory is not empty". And you have to kill all firefox exes, and restart.
Selenium Pros
  • You can find Selenium headquarters here, it gets an update once in a month or so. Have support forum which is alive, and you can almost find any fix to your problems.
  • Has support for almost every browser you can think of. Firefox, Chrome, Safari, etc.
  • Firefox comes with native support by Selenium, so you dont need external webdriver for that. 
  • HtmlUnit uses headless browser and even that one has webdriver support for Selenium.
  • Proxies can be easily applied for each webdriver instance, so you can run two browsers at the same time, one with proxy the other not.

If we come to the point, Watin has lost its support and this may be problem in a year or two since it runs good on Windows 7 but not on Windows8+. This is a huge issue, if you are going to invest for more than a year. You can choose Watin for short term projects which need performance.
On the other hand, Selenium has good support and despite the performance issues, it is reliable. It may lack some performance compared to Watin but I think it may be get better later. 

My vote goes for Selenium, as a former Watin-eer.

Mehmet





No comments:

Post a Comment