What is Automation Testing?
Automation testing is a way of automating the browser application by performing or executing the test cases. Using automation tests, we can perform parallel execution, which we can't do with manual processes. The manual process requires more manpower and more effort to execute the test case. Rather, we can do it using various Automation tools, like Selenium, CodedUI, and QTP, which require less time. Using automation testing, we can execute various scenarios multiple times, but in the case of using manual processes or manual testing, there may be chances of leaving such scenarios. The results are more accurate with automation testing and save a lot of time.
Different Automation Testing Tools in the IT Industry
Nowadays, everyone prefers various Automation Tools like QTP, CodedUI, Selenium, etc. Using these tools, we can get very accurate results compared to of manual processes. Selenium is open source whereas CodedUI and QTP both are licensed tools. Selenium is easy and fast in execution compared to QTP and CodedUI.
Usage of Automation Testing
Using Selenium or any other Automation Tool, we can perform various tasks, like execution of test cases with accurate results, and navigating through various scenarios and screens multiple times. Executing the test cases on remote machines by launching various browsers remotely reduces the time and effort.
What is Selenium and its components?
Selenium is an open-source automation tool that is used to execute test cases on web applications. Selenium supports various programming languages which include C#.Net, Java, Perl, PHP, Javascript, etc. It supports various platforms to perform execution; some of the platforms are Windows, Linux, Mac OS, windows -10(For Edge browser), etc. It supports various browsers to execute the test cases such as Chrome browser, Internet Explorer, Firefox, Safari, Edge, etc.
The various components of Selenium are,
- Selenium Core
- Selenium RC
- Selenium IDE
- Selenium Grid
- Selenium webdriver.
Among these, Selenium Core and Selenium RC (Remote Control) are part of Selenium version 1.0. Selenium IDE (Integrated Development Environment ), Grid, and Webdriver are part of Selenium 2.0. The popular ones in Selenium are Selenium Grid and Selenium Webdriver, as most of the top organizations are preferring these in their project development.
Why should I prefer Selenium over other Automation tools?
As I mentioned in my above answers, Selenium is an open source Automation tool, whereas CodedUI, QTP, or other tools are Licensed Versions. Selenium is very fast in execution compared to other tools. It supports execution on web applications as well as mobile applications like Android, IOS, etc.
What are the advantages of using Selenium?
You can refer to the above answers.
Using Selenium we can perform parallel execution with the help of hub and node configuration and it also supports execution of the test cases in remote machines which saves time and human effort.
How to find a control or element in Selenium?
We can have various elements or controls on a page like Textbox, radio button, dropdown, Button, Hyperlink, etc.
In Selenium after launching the browser we can perform various operations like clicking a button or selecting dropdown, selecting a checkbox or entering the value in a textbox, checking the radio button, etc based on our requirements.
For identifying the controls or elements, each element will have a unique property like Id, Name, Classname, Xpath, Tagname, CSS Selector, partial link text, etc.
Code for identifying the control
IWebDriver driver;
IWebElement element = driver.Navigate().GoToUrl("http://www.google.com");
element.FindElement(By.Id("Inputname"));
element.FindElement(By.Name("Inputname"));
element.FindElement(By.CssSelector("Inputname"));
element.FindElement(By.TagName("Inputname"));
element.FindElement(By.XPath("//Inputname"));
element.FindElement(By.LinkText("Inputname"));
These are a few examples of finding a control based on their unique properties.
Different versions of Selenium
As I have explained in my earlier questions above, there are three different versions of Selenium.
- Selenium 1.0 was the very starting version of Selenium which was released in 2004. In this version, we have Selenium Core and Selenium RC.
- Selenium 2.0 is the second version which was released in July 2011 and consists of Selenium IDE, Selenium Grid, and Selenium Webdriver. Most of the companies prefer to work on Selenium Grid and Selenium Web Driver. For more information, you can follow the official website(https://seleniumhq.wordpress.com/2011/07/08/selenium-2-0/)
- Selenium 3.0 is the latest version which was released in June 2016 and it has the following advantages or features.
Firefox Browser version is supported by 47+. If we want to work with the older versions; i.e., less than 47 versions, there is no need to install the Gecko driver but working with more than 47+ either in Selenium 2.0 or Selenium 3.0 requires the Gecko driver to be installed and configured.
- In this version, we also have support for Microsoft’s Edge Browser, which is Microsoft’s own browser.
- The following are the prerequisites to work with Edge Browser.
- The client machine should be installed with the Windows 10 Operating system.
- It supports Java greater than 8 versions to run Java code (hub).
- Support for Safari (Apple OS) Browser is provided by Safari drivers (10.0 version+).
- More than 9+ versions of IE are supported in Selenium 3.0.
- Now Selenium 3.0 has become a W3C (World Wide Web Consortium) standard.
- Selenium 3.0 removed Selenium Core but supports Selenium RC indirectly through back-end Webdriver.
- For more information, you can refer to the Selenium Official website (http://www.seleniumhq.org/about/news.jsp) and you can refer to my previous articles (http://www.c-sharpcorner.com/article/introduction-to-selenium-3-0/).
What is the usage of Xpath in Selenium?
If the control or the element is not identified by its unique properties like id, name, class, tag name, etc then in this situation we need to use Xpath. For some elements, there will be no unique properties or there may be properties with the same name for multiple controls like id=inputname for textbox and button. In this case, we need to use XPath to identify the control. Xpath will be unique for each control. Once we inspect the webpage by clicking on F12, we can highlight the element and right-click ---> And click on Copy Xpath.
What is the absolute & relative path in Selenium?
In Xpath Absolute path can be created by using a single forward Slash like ('/'). If we want to take XPath of control then it takes it from the beginning of the element.
/html/body/table/tr/td[2]
Relative path can be created by using two forward slashes like ('//'). If we want to take the XPath of control, the relative path starts in the middle of any element.
//table/tr/td[2]
What is the benefit of using Selenium Grid?
- Using Selenium Grid we will be able to execute the test cases in parallel and remotely in another machine by configuring a hub and a node.
- We can configure a single hub and multiple nodes from other machines that are connected to the LAN Network.
- Hub will act as a Server and distributes the test cases to different nodes which are configured to a particular hub.
What is a webdriver and its types?
Selenium webdriver is an object-oriented tool that consists of various classes and namespaces with which we can perform various actions on the web elements or controls.
- To Execute the test cases, each browser has its own drivers to execute.
- If we want to execute a test case in Chrome, we have a Chrome driver.
- If we want to execute a test case in Internet Explorer, we have an Internet Explorer driver.
- If we want to execute a test case in Safari, we have a Safari driver.
- If we want to execute a test case in Firefox, we have a Gecko driver. (Supported only for version 47+)
- If we want to execute a test case in Edge, we have an Edge driver.
- Selenium even supports execution in mobile applications like IOS/Android drivers which can be downloaded from (http://www.seleniumhq.org/download/).

Join the conversation! Your thoughts help the community grow.