Top Interview Questions & Answers | Learn Now

Selenium Interview Questions and Answers | Basic and Advanced Levels

Written by Anuradha | Mar 15, 2018 11:49:11 AM

Q1. What is Selenium?

Ans: Selenium is one of the most popular automated testing tool used to automate various types of applications. Selenium is a package of several testing tools designed in a way for to support and encourage automation testing of functional aspects of web-based applications and a wide range of browsers and platforms and for the same reason, it is referred to as a Suite. Due to its existence in the open source community, it has become one of the most accepted tools amongst the testing professionals. It consists of three main parts: Selenium IDE, Selenium RC & Selenium Web Driver. Each of these tools is designed to cater different testing and test environment requirements.

Q2. Where we use Selenium and why we use Selenium? 

Ans: Selenium is used in Automation Testing. Selenium is highly flexible Tool and is used to allowing more options for locating UI elements and comparing expected test results against actual application behavior and also is used to support for executing one’s tests on multiple browser platforms.

Q3. Why Selenium is good tool for Automation Testing?

Ans:

  • It is Free and open source
  • It supports distributed testing
  • It has regular repository developments
  • It has a large user base and support community
  • It has wide platform compatibility – Windows, Mac OS, and Linux, etc.
  • It has cross-browser compatibility – Internet Explorer, Chrome, Firefox, Safari, etc.
  • It supports multiple programming languages – Java, C#, Ruby, Perl, Python, etc.

Q4. What are the Selenium tools Components?

Ans: The Selenium tool package components are:

  • Selenium RC
  • Selenium IDE (Integrated Development Environment)
  • Selenium Web driver
  • Selenium Grid

Q5. What is meant by Selenium IDE?

Ans: Selenium IDE (Integrated Development Environment) is a plug-in used to record and replay tests in Firefox browser. Scripts may be automatically recorded and edited manually providing auto-completion support and the ability to move commands around quickly.

Q6. When we will use Selenium IDE?

Ans: Selenium IDE is the simple and easy tool of all the Selenium Package Tools. It has record and playback feature make it exceptionally easy to learn with minimal acquaintances to any programming language. Selenium IDE is an ideal tool for a naïve user.

Q7. What are the testing types that can be supported by Selenium?

Ans: Selenium supports the following types of testing’s:

  • Functional Testing
  • Regression Testing

Q8. What are the Disadvantages of Selenium?

Ans: Selenium supports testing of only web-based applications

Mobile applications cannot be tested using Selenium

Captcha and Barcode readers cannot be tested using Selenium

Reports can only be generated using third-party tools like TestNG or JUnit.

As Selenium is a free tool, thus there is no ready vendor support through the user can find numerous helping communities?

The user is expected to possess prior programming language knowledge.

Q9. How many types of selenium web driver APIs are available?

Ans: The list of driver classes could be used for the browser automation.

  • Android Driver,
  • Chrome Driver,
  • Event Firing Web Driver,
  • Firefox Driver,
  • Html Unit Driver,
  • I Phone Driver,
  • I Phone Simulator Driver,
  • Remote Web Driver
  • Internet Explorer Driver

Q10. What are the different types of locators in Selenium?

Ans: The locator can be termed as an address that identifies a web element uniquely within the webpage. Thus, to identify web elements accurately and precisely we have different types of locators in Selenium:

  • ID
  • Link Text
  • Partial Link Text
  • X path
  • DOM
  • Class Name
  • Name
  • Tag Name
  • CSS Selector

Q11. What is meant by Selenese?

Ans: Selenese is the language which is used to write test scripts in Selenium IDE.

Q12. What are the Technical Challenges in Selenium?

Ans:

  • Selenium supports only web based applications
  • It does not support the Bitmap comparison
  • For any reporting related capabilities have to depend on third party tools
  • No vendor support for tool compared to commercial tools like HP UFT
  • As there is no object repository concept in Selenium, maintainability of objects becomes difficult

Q13. What is meant by X Path in selenium?

Ans: X Path is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data. It stores data in a key-value pair which is very much similar to HTML tags. The fundamental behind locating elements using X Path is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element. Both being markup languages and since they fall under the same umbrella, X Path can be used to locate HTML elements.

Q14. What is the difference between the “/” and “//” in X path?

Ans: Single Slash “/” –  The Single slash is used to create Xpath with absolute path i.e. the xpath would be created to start selection from the document node/start node.

Double Slash “//” – The Double slash is used to create Xpath with relative path i.e. the xpath would be created to start selection from anywhere within the document.

Q15. When should we use Selenium Grid?

Ans: Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution, testing under different environments and saving execution time remarkably.

Q16. What do we mean by Selenium 1 and Selenium 2?

Ans: Selenium RC and Web Driver, in a combination, are popularly known as Selenium 2. Selenium RC alone is also referred as Selenium

Q17. Which is the latest Selenium tool?

Ans: WebDriver

Q18. How do I launch the browser using Web Driver?

Ans: The following syntax can be used to launch Browser:
WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
Web Driver driver = new Internet Explorer Driver();

Q19. What are the different types of Drivers available in Web Driver?

Ans: The different drivers available in WebDriver are:

  • Fire fox Driver
  • Internet Explorer Driver
  • Chrome Driver
  • Safari Driver
  • Opera Driver
  • Android Driver
  • IPhone Driver
  • Html Unit Driver

Q20. What are the different types of waits available in Web Driver?

Ans: There are two types of waits available in Web Driver:

  1. Implicit Wait
  2. Explicit Wait

Implicit Wait: Implicit waits are used to provide a default waiting time (say 30 seconds) between each consecutive test step/command across the entire test script. Thus, subsequent test step would only execute when the 30 seconds have elapsed after executing the previous test step/command.

Explicit Wait: Explicit waits are used to halt the execution till the time a particular condition is met or the maximum time has elapsed. Unlike Implicit waits, explicit waits are applied for a particular instance only.