2017/04/20

What is Selenium WebDriver

If you are just starting looking into Test Automation you must have heard something about Selenium, but not yet sure what it is. Let’s add some context and details to Selenium.


How Test Automation is working

Test Automation is pretty similar to manual testing and is dead simple. You need to make computer do something automatically. It can be done writing new small programs (scripts) which are called Automated Tests. 

Automated Test is actually a small program — piece of code in some programming language which simulates actions of real user.

If we talk about Web — Automated Test would be mainly interacting with Browser to do something like opening pages, clicking somewhere, etc. And this is where Selenium comes into play. 


What is Selenium

Selenium is a set of programming libraries which provides your scripts a way to interact with browser.

Selenium gives you an ability to:
  • Open pages
  • Finding some elements on a page
  • Performing various actions over elements like clicking or entering text into a text field
  • Take a screenshot of what’s displayed in browser
These actions are basically everything what user can do, so it is sufficient to write good Automated Tests.

Better part of it is that’s all this comes at no cost. Selenium is free and open source.

If you want to know more about Selenium and it’s history you can refer to official website — seleniumhq.org. A good place to start is Introduction to Selenium.


What is “WebDriver” part about

WebDriver brings a bit of confusion when you start learning about Selenium.

Why Selenium is sometimes called Selenium WebDriver? Because it’s using WebDriver standard underneath to interact with different Browsers.

But what is WebDriver standard? It’s a standard developed by creators of Selenium. Now it’s a W3C Standard available here — https://www.w3.org/TR/webdriver/.

This standard describes all the actions which user can perform over a browser and all the ways in which browser can respond. 

Given this WebDriver standard is an ideal intermediate level between Selenium libraries and actual browser. 

Selenium WebDriver is actually trying to work with something based on WebDriver standard. And here is where some wonderful things come into place — Browser developers (Google, Mozilla, etc.) were willing to support WebDriver standard and provide special versions of their browsers which can be controlled automatically (via WebDriver interface). These special versions of browsers are usually called Drivers.

Why this concept of WebDriver is good? Because when new browser arises like Edge — we will be able to automate it once it supports WebDriver standard. And no new work will be required from Selenium side.

This was a great effort by Selenium team to make it all work. Thanks to them and browser developers to let this happen.

But why selenium is called Selenium WebDriver, can’t is be just Selenium? This is a bit legacy thing. When Selenium was first developed — there were no such thing as WebDriver, it was working very differently. When new version was ready and WebDriver was in place — it was called “Selenium 2”, and sometimes to highlight how version two is different from the first one it’s called “Selenium WebDriver”. There is also a third version of Selenium which is still using WebDriver underneath.