Menu Close

Selenium Interview Questions

What is Automation Testing?

  • Automation testing is a process of automating the manual process to test the application/system under test.
  • Automation testing involves the use of a separate testing tool which lets you create test scripts which can be executed repeatedly.
  • It doesn’t require any manual intervention.

What is Selenium?

  • Selenium is one of the most popular automated testing suites.
  • Selenium is designed in a way to support and encourage automation testing of functional aspects of web-based applications and a wide range of browsers and platforms.
  • Due to its existence in the open source community, it has become one of the most accepted tools amongst the testing professionals.

What are the different Selenium components?

  • Selenium Integrated Development Environment (IDE) – Selenium IDE is a record and playback tool. It is distributed as a Firefox Plugin.
  • Selenium Remote Control (RC) – Selenium RC is a server that allows a user to create test scripts in the desired programming language. It also allows executing test scripts within the large spectrum of browsers.
  • Selenium WebDriver – WebDriver is a different tool altogether that has various advantages over Selenium RC. WebDriver directly communicates with the web browser and uses its native compatibility to automate.
  • Selenium Grid  – Selenium Grid is used to distribute your test execution on multiple platforms and environments concurrently.

What is the use of X-path?

  • X-Path is used to find the WebElement in web pages.
  • It is also useful in identifying the dynamic elements.

What are the benefits of Automation Testing?

  • Supports execution of repeated test cases
  • Aids in testing a large test matrix
  • Enables parallel execution
  • Encourages unattended execution
  • Improves accuracy thereby reducing human-generated errors
  • Saves time and money

Why should Selenium be selected as a test tool?

  • It is free and open source
  • It has a large user base and helping communities
  • It has cross Browser compatibility (Firefox, Chrome, Internet Explorer, Safari etc.)
  • It has great platform compatibility (Windows, Mac OS, Linux etc.)
  • It supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.)
  • It supports distributed testing.

What are the parameters you have to pass in Selenium?

  • Host
  • Port Number
  • Browser
  • URL

What is same origin policy?

  • It is introduced for security reasons, and it ensures that content of your site will never be accessible by a script from another site. 
  • As per the policy, any code loaded within the browser can only operate within that website’s domain.

What is Object Repository?

  • An object repository is an essential entity in any UI automations which allows a tester to store all objects that will be used in the scripts in one or more centralized locations rather than scattered all over the test scripts.

Mention 5 different exceptions you had in Selenium web driver?

  • WebDriverException
  • NoAlertPresentException
  • NoSuchWindowException
  • NoSuchElementException
  • TimeoutException

What are the two modes of views in Selenium IDE ?

  • Either Selenium IDE can be opened as a pop up window or in side bar

What is POM (Page Object Model)?

  • Page Object Model is a design pattern for creating an Object Repository for web UI elements.
  • Each web page in the application is required to have its own corresponding page class.
  • The page class is thus responsible for finding the WebElements in that page and then performs operations on those WebElements.

What are POM advantages?

  • POM allows us to separate operations and flows in the UI from Verification – improves code readability
  • Since the Object Repository is independent of Test Cases, multiple tests can use the same Object Repository
  • Reusability of code

What is Page Factory?

  • Page Factory gives an optimized way to implement Page Object Model.
  • When we say it is optimized, it refers to the fact that the memory utilization is very good and also the implementation is done in an object oriented manner.

What are Assert and Verify commands?

  • Assert: An assertion is used to compare the actual result of an application with the expected result.
  • Verify: There won’t be any halt in the test execution even though the verify condition is true or false.

What is Selenium 3.0, and why is it superior to 2.0?

  • It was a major WebDriver upgrade which landed up in 2016.
  • It is superior to 2.0 because it implemented the W3C specifications for Webdriver APIs to make them a global standard.
  • Until 3.0, it was the Selenium community that was supplying Web drivers for specific browsers.
  • But now, they provide their respective drivers that support the standard Web driver API interface.

What are the pros/benefits of using Selenium Grid?

  • Support concurrent test execution and hence saves us a lot of our time.
  • It presents us with the ability to execute test cases in different browsers.
  • After creating multi-machine nodes, we can use it to distribute tests and execute them.

What is a Framework?

  • A framework defines a set of rules or best practices which we can follow in a systematic way to achieve the desired results.
  • There are different types of automation frameworks and the most common ones are:
    • Data Driven Testing Framework
    • Keyword Driven Testing Framework
    • Hybrid Testing Framework
    • Behavioral Driven Framework

What is Selenium IDE?

  • Selenium IDE (Integrated Development Environment) is a Firefox plugin.
  • It is the simplest framework in the Selenium Suite.
  • It allows us to record and playback the scripts.
  • Even though we can create scripts using Selenium IDE, we need to use Selenium RC or Selenium WebDriver to write more advanced and robust test cases.

What is a node in Selenium Grid?

  • Node is the machine which is attached to the hub. There can be multiple nodes in Selenium Grid.

What is WebElement selenium?

  • WebElement in Selenium represents an HTML element.
  • It basically represents a DOM element in a HTML document.

What is Fluent Wait In Selenium WebDriver?

  • FluentWait can define the maximum amount of time to wait for a specific condition and frequency with which to check the condition before throwing an “ElementNotVisibleException” exception.

What is TestNG?

  • TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing to integration testing.

What is Locator? How will you locate an element in Selenium?

  • Selenium uses locators to find and match the elements of a web page that it needs to interact with.
  •  There are different types of locators to identify various web elements on a web page:
    • Identifier
    • ID
    • Name
    • Link
    • DOM
    • XPath
    • CSS
    • UI element

What is Selenese?

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