Saturday, July 6, 2013

Migrating from Selenium To WebDriver

We all know that WebDriver is improved and enhanced version of Selenium commonly known as Webdriver or selenium 2, the Selenium team is now more focused  on webDriver and currently doesn't provide much support for Selenium(1).

So people who are using Selenium from its inception or before webDriver are facing biggest challenge that how to easily migrate from Selenium to webDriver. There is a class named webDriverBackedSelenium  which provides both selenium as well as webDriver functions but its not a clear approach as even if you use this class you have migrate to pure webdriver later, Using WebDriverBacked is a quick Step but it is a temporary Solution, you can also migrate to WebDriver easily.

I will now explain how I performed the migration process

We are using Selenium from last 2 years and we have written all our test cases in Excel sheets and use them for executing test cases using a self written java framework. Selenium functions are executed using JAVA reflection property.

So biggest challenge was how to minimize the effort required in changing existing test cases when we migrate from selenium to Webdriver

I have designed a new class for webDriver functions and defined all selenium functions in that but using webDriver, function name is same as Selenium functions but it uses webdriver classes then defined a new class which executes these functions using reflection. Using this approach, now it requires a very little effort to change existing input sheets and also little training is required for existing users for using the new Suite

Now my new suite can handle both webdriver requests as well as Selenium requests

I have just started using webDriver but i must say it is much better than Selenium.