Top 15 Selenium Interview Questions and Answers

Top 15 Selenium Interview Questions and Answers

1. What is class in java?

  • A class is a blueprint or a template for creating different objects which defines its properties and behaviors.
  • Java class objects exhibit the properties and behaviors defined by its class.
  • A class can contain fields and methods to describe the behavior of an object.

2. Features of Java

  • Object Oriented
  • Platform Independent
  • Simple
  • Secure
  • Architecture-neutral
  • Portable
  • Robust
  • Multithreaded
  • Interpreted
  • High Performance
  • Distributed
  • Dynamic

3. Types of Applications that Run on Java

  • Desktop GUI Applications
  • Mobile Applications
  • Embedded Systems
  • Web Applications
  • Web Servers and Application Servers
  • Enterprise Applications
  • Scientific Applications

4. What are the Java Modifiers?

There are two categories of modifiers:

  • Access Modifiers: default, public , protected, private
  • Non-access Modifiers: final, abstract, strictfp

5. What is Java Inheritance?

  • Inheritance can be defined as the process where one class acquires the properties (methods and fields) of another.
  • The class which inherits the properties of other is known as subclass (derived class, child class) and the class whose properties are inherited is known as superclass (base class, parent class).

6. List the Components of Selenium

  • Selenium Integrated Development Environment (IDE)
  • Selenium Remote Control (RC)
  • Selenium WebDriver
  • Selenium Grid

7. List Out Some Web Elements

  • Browser
  • Page
  • Edit Box
  • link
  • Button
  • image-simple image, Image Link, Image Button
  • Text Area
  • Check Box
  • Radio Button
  • Drop Down Box
  • List box
  • Combo box
  • Web Table/HTML Table
  • Frame

8. List the Element Locators that Support Selenium

Selenium supports 8 element locators to recognize elements

  • className
  • cssSelector
  • id
  • linkText
  • name
  • partialLinkText
  • tagName
  • xpath

9. What is Xpath?

  • XPath is defined as XML path.
  • It is a syntax or language for finding any element on the web page using XML path expression.
  • XPath is used to find the location of any element on a webpage using HTML DOM structure.

10. What is Selenium WebDriver?

  • WebDriver is a tool for testing web applications across different browsers using different programming languages.
  • You are now able to make powerful tests because WebDriver allows you to use a programming language of your choice in designing your tests.
  • WebDriver directly talks to the browser.

11. Advantages of Selenium WebDriver

  • It supports with all browsers like Firefox, IE, Chrome, Safari, Opera etc.
  • Doesn’t require start server before executing the test script.
  • It actual core API which has binding in a range of languages.
  • Interacts natively with browser application.
  • API’s are entirely Object oriented.
  • It supports of moving mouse cursors.
  • It support to test iphone/Android applications

12. What are the Methods on Browser?

  • get()
  • getTitle()
  • getCurrentUrl()
  • getPageSource()
  • getWindowHandle()
  • close()
  • quit()

13. What are the Browser Navigation Commands

  • navigate().to()
  • navigate().forward()
  • navigate().back()
  • navigate().refresh()

14. What is TestNG?

  • TestNG is testing framework inspired from most popular JUnit framework used for the Java programming language.
  • The TestNG framework is introduced to overcome the limitations of JUnit framework.
  • Most of the automation users are using this framework because of its advantages & more supported features.
  • Using this TestNG framework we will learn how to generate test reports.
  • TesNG is an open source framework.

15. Features of TestNG Framework

  • Test configuration flexible.
  • Supports powerful execution model.
  • Support for parameters.
  • Supports dependent methods testing.
  • TestNG supports Data driven testing using DataProviders.
  • For the same test class TestNG support for multiple instances.
  • Extendibility of using different Tools and plug-ins like Eclipse, Maven, IDEA etc.
  • Default JDK functions for runtime and logging (no dependencies).
  • Supported different Annotations like
    • @BeforeSuite,
    • @AfterSuite,
    • @BeforeClass,
    • @AfterClass,
    • @BeforeTest,
    • @AfterTest,
    • @BeforeGroups,
    • @AfterGroups,
    • @BeforeMethod,
    • @AfterMethod,
    • @DataProvider,
    • @Factory,
    • @Listeners,
    • @Parameters,
    • @Test.