The biggest name in ‘Software Testing’ now-a-days, or at least from few years – Selenium. What’s Selenium? The Android of Web Automation! And what makes it so popular? Yeah! Its open source, but – though free it still need to be useful to gain popularity of such momentum. What makes it so appealing? So useful? Appropriate? Easy-to-use? Powerful? The answer is – Selenium WebDriver!
First of all, don’t get lost in the ocean of Selenium terminologies spread across the web, we here try to be as short and clear in the explanation. How do you think browser automation should work for a web-based automation? Inserting a script in webpages? No, right? Then? Wouldn’t it be great if a human being is replaced by an automation tool to perform browser actions on a web page? Just like we do? Yeah! As the name suggests, Selenium Webdriver is just that tool for you – driving a browser (web) natively as a user would either locally or on a remote machine using the Selenium Server. Selenium WebDriver was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems.
Trivia: Selenium 1.0 + WebDriver = Selenium 2.0
We are not here to compare Selenium 2.0 with earlier version – we will just focus on WebDriver.
How Does Selenium WebDriver ‘Drive’ the Browser?
Selenium WebDriver: makes direct calls to the browser using each browser’s native support for automation. I.e. As a tester you write the automation test script >> for each Selenium command, a HTTP request is created and sent to the browser WebDriver component >> The WebDriver uses a HTTP server for getting the HTTP requests >> the HTTP server determines the steps needed for implementing the Selenium command >> browser executes the HTTP request sent by the WebDriver & sends the results back to the HTTP server >> the HTTP server sends the status back to the automation script. Simple, right?
Note: WebDriver takes advantage of the browser’s native compatibility towards automation.
WebDriver supports diverse range of web browsers and their versions – Firefox, Internet Explorer, Chrome, Safari and HtmlUnit (headless browser, i.e. GUI-less mode). WebDriver also supports web based Mobile testing. Thus it provides AndroidDriver and IphoneDriver to back web based mobile testing.
Supported Programming languages
WebDriver facilitates the user to choose within the different programming languages to build test scripts which enables you to use conditional operations, looping and other programming concepts which makes test script robust. Following programming languages are supported by WebDriver
- Java, .Net, C#, PHP, Python, Perl, Ruby
Don’t worry. No need to learn all of these 🙂 Knowledge of any one (as per your choice & competency) should be more than enough!
The need for Selenium-Server
The need for Selenium Server depends on how you intend to use Selenium WebDriver. If your browser and tests will run on the same machine, and your tests only use the WebDriver API, then you do not need to run the Selenium-Server; WebDriver will run the browser directly.
But you need a Selenium-Server in case you are using Selenium-Grid to distribute tests over multiple machines or virtual machines, connecting to a remote machine to access different browser, executing scripts on HtmlUnit Driver, OR executing scripts on multiple platforms.
The key take-away
Selenium suite is comprised of 4 basic components – Selenium IDE, Selenium RC, WebDriver and Selenium Grid. In simple terms – WebDriver, the most powerful of all, is a tool for testing web applications across different browsers using different programming languages. WebDriver takes advantage of the browser’s native compatibility towards automation. With the increasing demand it has gained a large popularity, user base and has become by far one of the most extensively used open source automation testing tool.
So what are you waiting for? Download Selenium NOW!