Selenium Interview Questions Part 1
Note : You can add questions and answer in comments section after the post. We will add them to the series if not duplicated.
1) What is Selenium ?
Selenium is a open source tool used for web based automation testing. It comprises of multiple software tools mentioned below
- Selenium IDE (Integrated Development Environment) : It is a tool for recording and playing back. It is a firefox plugin
- Selenium 1 or Selenium RC(Remote control) : Selenium RC was the main Selenium tool launched initially but because of some limitations it deprecated and is not actively supported (mostly in maintenance mode).We used to start the Selenium server before start testing and act as a middle man between browser and selenium commands.
- Selenium WebDriver or Selenium 2: Selenium WebDriver was introduced to overcome of the limitations of Selenium RC. WebDriver can directly interact with the browser and having simplified architecture than Selenium RC.
- Selenium Grid: It helps to execute different test cases parallel at different remote machine. You can specify desired platform like Windows, Mac etc. and browsers like chrome, Firefox etc.
2) Which one to use Selenium IDE or Selenium WebDriver?
Selenium IDE: It is a firefox add-on and basically a record and playback tool. If you are totally beginner and wants to have first exposure how the application functionality get automated. Then you can play around this. Simply record the steps on the application and playback. You can read about it in details here..
Selenium WebDriver: Is is the recommended tool if you are going to automate application in your company project and wants to have a well structured test cases. This is basically jar files which you need to configure with you IDE like Eclipse etc. and you can start using its methods. How to configure it, you can look at this.
3) What kind of testing is done with selenium?
Selenium can be used for web based testing for the following test types
4) What is automation testing?
In manual testing, a tester performs the application functionalities manually by opening the application, enter input data, validate output etc. Automation testing helps to automate the application functionality(or test cases) with the use of some automation tool and avoid the manual intervention. An automation process will be developed to open application, enter data, validate output, generate details reports etc.
5) What are the benefits of automation testing?
Benefits of automation testing are
- Test execution is faster than manual test execution.
- A complex business logic can be executed more precisely at any time once automated. Where in manual process, there may be chances of human error if need to perform again and again.
- Supports unattended execution.
- Enables parallel execution.
- Saves time and money.
- Increases Efficiency.
- Improves re-usability
- Test Frequently and thoroughly
6) Why should we select selenium as an automation tool?
There are few points which we can consider while selecting as preferred tool for automation.
- It is free and open source.
- It supports cross browser testing (Firefox, chrome, Internet Explorer, Safari etc.)
- It supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.)
- It supports different platform compatibility (Windows, Mac OS, Linux etc.)
- There are many free communities and forums that supports selenium and may give a way to good learning.
- Supports parallel testing.
- Can be integrated with the continuous integration tools like jenkins,hudson etc.
7) What are the limitations of Selenium?
There are following limitations of selenium.
- Supports only web based application testing.
- Reports can only be generated using third party tools like TestNG or Junit.
- Captcha and Bar code readers cannot be tested using Selenium.
- As selenium is free, so no authorized vendor support like QTP/UFT has.
8) What are the locators available in selenium and mention their sequence of preference?
There are 8 type of locators which are mentioned below in the sequence they should be preferred.
Select element with the specified @id attribute.
Select first element in the page with the specified @name attribute.
Select link (anchor tag represented by ‘a’) element which contains text matching the specified link text.
Select link (anchor tag represented by ‘a’) element which contains text matching the specified partial link text.
Locate Element by given Tag Name .
Locate Element using a Class Name .
Select the element using css selectors. For more detail look at this post.
Locate an element using an XPath expression. For more detail look at this post.
9) What is the difference between “/” and “//” in Xpath?
Single Slash “/” – Single slash is used to create Xpath with absolute path i.e. the xpath would be from the root node in HTML DOM.
Double Slash “//” – Double slash is used to create Xpath with relative path i.e. the xpath would be from the desired node at any point in the DOM.
10) What is Selenium WebDriver?
The simple answer would that WebDriver is an interface which is implemented by the selenium classes to utilized its methods.