• Jobs
  • About
  • Introduction to Selenium March 18, 2009

    What is Selenium

    Selenium is one of the most popular tools for browser based testing. It is an Open Source project that has gained a lot of popularity in the last few years. Even though there are other Open Source (free) tools that can test a web application, like HttpUnit, HtmlUnit etc, this was one of the first tools that provided a real alternative to commercial tools like Quick Test Pro (QTP), WinRunner, Silk and others that had gained significant adoption by the QA Engineers.

    What Selenium is good at

    There are a few factors that have attributed to Selenium’s success.

    1. Since this is a free tool, it often is one of the few options for companies that do not have a lot of budget for Automation tools.
    2. Selenium was first written in Java but it also supports .Net, Ruby, Perl, PHP and Python. This is a big plus when you want to build your framework in a language that has the highest adoption in the organization it is being built within. Tools like QTP force you to use VBScript – which is almost never the preferred scripting language for developers.
    3. Since this instantiates and drives a real browser, as opposed to simulated browser solutions like HtmlUnit, this tool runs in a client that is closer to what a real user would use. This in turn provides more confidence that tests run with this tool would catch most issues that a real user would experience.
    4. It has support for all of the popular browsers like IE, Firefox, Chrome, Safari etc. It also supports several Operating Systems and that makes it a tool of choice for cross browser/ cross platform certification.
    5. The developer community of Selenium are always trying to push the envelope of what can be achieved with browser automation. Drag and drop, key press actions, flex support etc are some examples of this.
      Besides that, there are companies like Sauce Labs who are provide a service called Sauce OnDemand which is a cloud service that allows users to execute their Selenium scripts in parallel.
    6. Once you get Selenium to work for you, it works reliably when used for running the tests over and over again. It’s definitely a lot more reliable than tools like QEngine or JExplorer but about the same as tools like QTP.
    7. You can instantiate several concurrent tests with Selenium Grid. Good luck trying that with tools like QTP!

    What Selenium is not good at

    Selenium 2.0 has been released recently and in this release they have fixed several issues that existed in Selenium 1.0.3. For instance Selenium 2 has an improved API which gives user more control on the browser actions than they did in the past.

    Some of the drawbacks that still do exist are:

    1. Selenium’s does not have a concept similar to an Object Repository (OR) in QTP. Some programmers consider this as a con of Selenium. Personally, I think QTP’s OR comes with it’s baggage as well.
    2. Selenium 1.x didn’t work very well with SSL – especially self signed ones (which are more common in the QA Environments). I have yet to try it with Selenium 2.
    3. For those who are not trying to test the browser but using the http layer just to test the underlying code, they will find alternatives like HtmlUnit to be much faster.
    4. With Selenium 1, if you navigated to a page with a javascript error, you could not detect it. There were some hacks we did to get around it but it was painful.
      I have yet to check if Selenium 2 has fixed that.
    5. Ever heard arguments against use of Open Source tools? They all go along the lines that product support is unavailable or expensive, documentation is scarce, improvements come slowly and unreliably etc. The good news is that I have found these to be untrue for most of the Open Source tools I have used. The bad news is that Selenium is not one of them. Selenium has been really slow in supporting new browsers and providing fixes for issues the community is facing, and their Javadocs still suck.

    Where does this leave us?

    So, with all the above information you must be wondering where does this leave us! Here are some guidelines:

    1. If browser certification is not the focus but the point of the tests are just to ensure functional behavior, then HtmlUnit might be a better choice.
    2. If you do not have any real browser automation today and are convinced that simulated browser testing wont work for you, then Selenium is still one of the best options today.
    3. If you already have a tool like QTP or Watir/ Watij, the decision to switch to Selenium depends on whether
      1. you have the time and resources to switch to a new tool AND
      2. leverage the additional capabilities Selenium provides (concurrent execution, drag-n-drop, flex support etc) OR
      3. absolutely need to test on all browsers.
    Posted by Rahul Poonekar in : Selenium

    7 responses to “Introduction to Selenium”

    1. I just wanted to drop you a line and let you know that I ran across this blog post while trying to do some research on Selenium in prep for a client meeting tomorrow where they are leveraging this tool. I found it to be extremely informative — great high level approach with a good amount of detail. This is just what I needed.

      Best regards,
      Mike

    2. Chamila Wijayarathna says:

      Thank you. This was very informative.

    3. Steve Barnas says:

      Rahul: In my journey to learn Selenium/Webdriver what I’ve found is that there are a ton of scattered articals of varying quality that one must sift through to get to some truly useful nuggets. Your site is one of the best I’ve seen. Thank you for your service to the community !

    4. Rahul Poonekar says:

      Thanks Steve. I try to add what I can with the time I have. If you have other articles that you think would be beneficial, please send them to me and I will try to add them here.

    5. Jerry Leventer says:

      Rahul,

      Regarding what you said about support for Open Source products, I would agree that it can sometimes be of less quality than for a paid product. But I’ve seen exceptions for both.

      Since you wrote the original article in March 2009, I was wondering if you have found in the last 3 years that support for Selenium has improved?

      Thanks.

    6. rajesh says:

      how can i take screen shots form selenium RC?

    7. Divya says:

      Thank You Rahul for sharing such useful information

    Leave a Reply

    Your email address will not be published. Required fields are marked *