I want to know the reasons why testers use WebDriver instead of Selenium IDE. Can someone explain?
Great question, and here is the answer:
Selenium IDE is a Record and Playback tool, which is very easy to use, but it’s very unreliable. Record and playback is typically a frowned upon in web applications. Since web applications are frequently changed, the IDE is not an ideal solution for a production environment, because of the maintenance nightmare that may arise.
Let me give you a practical example. You record your test, and you find an element with a dynamic ID. Sure we can import it into eclipse, but what happens when that test starts failing down the road? why not simply make your test agile and independent to catch these in the first place.
It also boils down to your principles of test automation. Test automation in MY opinion (and several other professionals), believe that test automation should be approached from a programming perspective. Programmers should write the tests, and maintain the tests. Ideally, your quality assurance personnel should be trained to write and maintain their own tests.
So again, back to your question, the IDE is designed to be a quick solution to automation, NOT a solution to a full regression suite.
And can anyone please explain why IDE recorded scripts fail in Webdriver?
I haven’t used the IDE in a while, but the reason they fail, is because the scripts that are exported, are simply the steps, not an entire java file. This also is because Selenium IDE exportations are supposed to be agnostic when it comes to how to run your test. Say I’m a user of jUnit… what if Selenium IDE exported it to TestNG all the time? That wouldn’t be fair… honestly i’d rather create my own tests than changing that one line every single time i create my test file.
When you reach testing community experts, they would surely suggest using Web Driver instead of selenium. This is because of the speed and simple architecture of the WebDriver. Unlike Selenium that uses an RC server to communicate with the browser, WebDriver allows you to directly communicate with the browser.
More importantly, the API’s are more concise in WebDriver than in Selenium while WebDriver even provides additional support on HtmlUnit which is not possible with Selenium.
Being VP at BugRaptors, here is link on the same topic that help you understand better about how and why we must choose selenium webdriver over selenium ide.