Selenium Tutorial — 1: What is selenium and how we can do testing with it?
Selenium is the popular java library that helps us to automate the browser which means with the help of the selenium library, We can open the browser, Open URL, Click, Enter, scroll, and almost everything which you can do while you are using it manually.
Selenium allows us to control the browser programmatically which means we can write the programs to open our application under test and stimulate the user behavior.
Selenium supports all the modern browsers available in the market which means you can run your test across the various browser and achieve cross-browser testing.
How Selenium Works?
Selenium uses the web driver for supporting all the major browsers.
Webdriver is an API and protocol that defines the interface for controlling the behavior of the browsers.
Each browser has its own webdriver implementation which commonly knows as the driver. A driver is behaving as a mediator between browser and selenium and responsible for communicating to and from between them.
This driver is a separate entity from the selenium and developed and maintained by the respective vendor of the browser.
The driver is specific to the browser like
- Chrome driver is for the Chrome/Chromium, which is supported and maintained by the Chromium project.
- Gecko driver is for the Firefox browser, which is supported and maintained by Mozilla.
- Edge driver is for Edge Browser, which is supported by the Microsoft
- Safari driver is for the Safari Browser which is maintained by the Apple
- Opera driver is for the Opera Browser which is supported by Opera Software.
here, the driver runs in the same machine where the browser is installed. This is an example of Direct Communication. the driver also can communicate with the remote host/machine through the selenium server or remote webdriver.
Above both is the example of remote communication using a remote webdriver and selenium server. Remote Webdriver runs into the same machine as a browser.
How we can utilize selenium in testing?
Webdriver is only doing one thing, which is communicating with the browser by methods mentioned above. It doesn’t know anything regarding the comparing value, assert pass or failed, or generating a report.
You need to use programing language concepts like assert or object comparison to make the selenium script into a Test Script,
Without assert — a selenium script is just a user action on the browser but not a test script.
You also need to use the Test framework like TestNG, Cucucumber for managing your test script in a better way.
That’s all for this post,
In the next post, We will explore how to find the element and perform various action browsers using selenium.
If you wanted to get a regular update on the Testing blogs and news, join my groups, and if you have doubt or confusion feel free to ask the question on our forum.
Originally published at https://www.testerin.me on April 22, 2021.