Obvious reason to switch from Selenium RC to Webdriver.?

Over the past 4 months, we have been conducting automation tests using Selenium RC .

But I recently found out that Selenium RC is out of date. So many people have suggested that I switch to Selenium Webdriver .

So, can anyboby tell me what the problem is with Selenium RC and how is Webdriver better than RC ??

Thanks.

+7
source share
2 answers

Well, there are several reasons. There is no special order

  • Webdriver offers a cleaner API than selenium RC. The most common example is you have selenium.type and selenium.typeKeys, both doing the same thing in action. Webdriver offers only one sendKeys method for all type-related actions. In a word, can you say that webdriver classes are better organized?

  • Selenium works using javascript injection. If you have been working with selenium for some time, you should be aware of the same problems with the original policy and limitations in javascript injection. Webdriver overcomes this by using a driver for each browser. For firefox, this means that webdriver joins the browser as an add-on, for IE it uses automation atoms, and for chrome and opera, the chrome driver is used.

  • Due to the above reason, webdriver tests are faster than Selenium

  • Its much easier to expand webdriver compared to selenium. Webdriver provides extensible action classes that you can combine and create your own custom actions.

  • Webdriver can support testing on mobile devices such as Iphone, ipad and android phones and tablets.

Last but not least, there is currently no development work going on in the selenium project. Everything that is available now will continue to be supported, but no new methods or improvements for selenium are happening. Selenium and webdriver projects were merged several years ago and became Selenium 2.0

Further information on webdriver can be found here and the reason for the merger here.

+13
source

What AJ said.

There are limitations on RC that cannot be easily overcome.

  • Extensibility is a big problem. I seriously cannot stress this. When I expanded some of the RC methods to do more work, they did it normally, I ran into a barrier that could not be easily passed. What can be done in RC with 750 lines of code and intensive use of the command template can be done in WebDriver with just a few simple methods.

  • the same origin policy . This is a Javascript security policy that allows you to run code only from the domain in which you are located. And since RC is completely written in Javascript, you cannot easily switch between domains or work with some websites that redirect or use frames with content from many domains.

  • Due to a different security policy in Javascript, you cannot fill in the inputs <input type='file' /> and use several workarounds.

  • You cannot work well with onload modal Javascript dialogs. Those, again, should work.

    Selenium tries to hide these dialogs from you (replacing window.alert, window.confirm and window.prompt), so they will not stop the execution of your page. If you see a pop-up warning, it’s probably because it was launched during the page loading process, which is usually too early for us to protect the page.

  • You cannot maximize the window in RC :).

  • You need to write your own methods when you need to wait for an element.

  • RC is no longer being developed; there will be nothing new. It took some time for WebDriver to grab hold of all the features, but now it's time that WebDriver finally has a little more to offer than RC (expectations and maximization). And it will only get better!

  • The RC method getEval() is a bad cousin of WebDriver executeJavascript() . The first returns a String and cannot be specified, for example. specific page element. The latter can return many built-in language data structures, WebElements , Lists WebElements , and can take them as arguments! This means that you can find the element with WebDriver and then run multiple JS on it. With RC, you will also need to find the element using JS. This can be done, but more complicated and much more error prone.

Mainly. There is also a reason to NOT switch: the WebDriver API is young and still changing. Sometimes a small change in behavior occurs when they correct a mistake. Therefore, sometimes there is pain in the ass in order to renew and find that she broke something.

However, I would not return to RC, since WebDriver is so nice to work with. And I look forward to a lot next year when WebDriver, we hope, will fix the most unpleasant oddities.

+7
source

All Articles