It is a web automation framework which allows us to execute test across various browsers. It can execute multiple tests over multiple browsers on multiple OS. WebDriver makes it possible to write a test script in Linux and run it in Windows. There are multiple programming languages which are supported by Web Driver such as Java, Python, Ruby, .Net, PHP to create test scripts.
In Selenium2, integration of Web Driver was considered which was designed to address few limitations of Selenium RC.
It can test dynamic websites where the content of pages changes by a mouse click.
By Web Driver, mobile automation is also feasible.
Web driver comes with another advantage which is its use on HTMLUnit browsers(HTMLUnit browser are headless browsers which means these are invisible to the user, in simple words they have no GUI), due to these testing on HTMLUnit browser is faster as these browsers save the time needed to load the page elements. This results in less execution time for test cases.
Browser vendors will ship their own WebDriver implementation, hence are tightly coupled to the browser giving a better testing experience.Modern Browsers such as Edge, Safari are introduced with the WebDrivers shipped by their vendors
WebDriver makes direct calls to the browser using each browser’s native support for automation. It uses browser driver for this communication
WebDriver contributes its object-oriented API for Document Object Model (DOM) interaction and browser control.
When any Automated Script is executed, for every Selenium command, HTTP Request is created and sent to browser to driver. The browser driver uses a HTTP Server for getting HTTP Requests. This HTTP Server determines the steps needed for implementation of Selenium command. The execution status which is run on browser is sent back to HTTP Server, which sends the status back to automation script.
Automation Testing −
It automates web application testing by imitating the user action on web application using selenium commands. It imitates the real actions by handling mouse and keyboard events. Web Driver talks to the OS directly using the OS’s native capability. It uses browser driver for this communication
Performance Testing −
By putting Selenium Grid to use, we can use selenium to test the maximum load our server or application can handle. In short, selenium here can be used for Load Testing, Stress Testing.
Regression Testing −
The most tedious task, but yet very important and necessary, Regression Testing. Selenium can be put to use in executing regression test bed. Since, selenium requires minimum human effort. It increases the speed of regression testing but executing the entire test bed faster. This leaves less room for bugs and errors.
Mobile Testing −
As world is moving towards mobile, we can use selenium to test mobile based applications.
Sanity Testing −
In large organizations where the teams are huge, and roles are clearly defined. There is a requirement of a tool which can be used to check the application after each build. This testing is not very exhaustive but checks for basic functionalities like logins and so-on.
Enough of testing, selenium is not limited to testing. It can be put to use in −
Monitoring of Applications −
To check if the application is up and running. This activity is very mandatory to be performed to understand and capture if the application has been closed down due to some errors.