• Jobs
  • About
  • What is new in Selenium 2 February 19, 2011

    Selenium 2 is still in beta but we now have a decent idea of what is coming in its next release. Here is the gist of it:

    A new and more expressive API

    The Selenium API has changed in Selenium 2. One very noticeable change is that in Selenium 2 we now have getters for html elements which we can perform actions against. In Selenium 1 and earlier, the apis performed actions directly on the locators.

    Browser specific drivers

    The Selenium and WebDriver projects have merged in Selenium 2. The WebDrivers are browser specific implementations of the Selenium 2 API. Unlike Selenium 0.x and 1.x, which relied on a single javascript implementation for all browsers to interact with their page elements, and so was limited by what could be achieved through javascript, the WebDrivers interact with the browsers in the best way possible for that browser.

    What this in turn allows is:

    1. Native keyboard and mouse interactions. This mimics the end user interactions with the browser much better than what earlier versions of Selenium provided, while being faster and more stable.
    2. Problems related to Same origin policy in Selenium 1 are now gone.
    3. Better support for handling popups and dialogs. This includes some big problem items like upload and downloads.

    Mobile web support

    Selenium 2 now supports running tests in mobile devices. IPhone and Android are the two platforms supported. The way it works is that you would have to install an app (a mini selenium server) on the device. This listens for commands which then drives the web browser within the app.

    This mechanism however will not allow us to test native apps in these devices.

    OS interactions

    Selenium 2 is still a web automation tool but it now does allow a few interactions with the OS. These interactions are related to the web browser though. For instance, you could potentially interact with the OS to handle invalid SSL warnings.

    No need to start Selenium server

    When you start using the new WebDriver API, you don’t need to run the Selenium server. Infact if you just have the WebDriver API jar (selenium-java-2.5.0.jar for instance) in your classpath, you wont have the classes required to start the selenium server. For that you will need to download the standalone server jar file as well.

    If you use the Selenium-backed WebDriver i.e. using Selenium 1 API but Selenium 2 jar (yes this is supported too), or you need to use Selenium Grid, you would still want to run the server. You would choose this option if:

    • You dont have the time to refactor your code to use the newer webdriver APIs, but need support for the latest browsers.
    • You are using selenium grid that allows disributed test execution.

    However, if you don’t use the new WebDriver APIs though, you will loose the other Selenium 2 benefits you get that were mentioned above.

    Upgrade or not?

    If you are starting to implement web test automation, I would recommend using Selenium 2 for sure.

    The question about upgrade is not as simple an answer as I would like it to be. On one hand, the Selenium contributors seem to be spending a lot of time ensuring there is backward compatibility. Infact, it is one of the reasons why the final release is taking longer. On the other hand, the changes in Selenium 2 are very significant. In some ways it almost feels like it is a completely different tool. So I would expect to see some issues early on. I have started using Selenium 2 recently and as I get more data, I will update this page so stay posted.

    Posted by Rahul Poonekar in : Selenium

    4 responses to “What is new in Selenium 2”

    1. MMAHE says:

      I would like to have more details on installing SELENIUM 2.
      I have install the pom.xml file.
      But I can’t run SELENIUM 2 from a command-line.
      Thank you for attention.

    2. Rahul Poonekar says:

      Did you get a chance to look at the simple Selenium 2 example? Let me know if that doesn’t help you.

    3. KUNAL GARG says:

      hi i want to download Selenium 2 from where can i download it………..please provide the link

    4. Rahul Poonekar says:

      You can download it from here: http://seleniumhq.org/download. I recommend that you read the next post (Getting started with Selenium 2) which describes what binaries to download and how to set it up.

    Leave a Reply

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