Selenium Interview Questions and Answers

Rate this interview

Nowadays, many organizations expect freshers to be prepared and answer selenium interview questions.

What is Automation Testing?

Table of Contents

One of the most important question from selenium interview questions , Automation testing is the process of testing the software using an automation tool to find the defects. In this process, executing the test scripts and generating the results are performed automatically by automation tools. Some most popular tools to do automation testing are HP QTP/UFT, Selenium WebDriver, etc.,

Which WebDriver implementation claims to be the fastest?

The fastest implementation of WebDriver is the HTMLUnitDriver. It is because the HTMLUnitDriver does not execute tests in the browser.

What are the Programming Languages supported by Selenium WebDiver?

• Java
• C#
• Python
• Ruby
• Perl

What are the Operating Systems supported by Selenium WebDriver?

• Windows
• Linux
• Apple

What are the Open-source Frameworks supported by Selenium WebDriver?

• JUnit
• TestNG

What are the Locators available in Selenium?

one of the most important question from selenium interview questions

Different types of locators are:

  1. ID –
  2. ClassName –
  3. Name –
  4. TagName –
  5. LinkText –
  6. PartialLinkText –
  7. XPath –
  8. CSS Selector –

What is a XPath?

XPath is used to locate the elements. Using XPath, we could navigate through elements and attributes in an XML document to locate web elements such as textbox, button, checkbox, Image etc., in a web page.

What is the difference between “/” and “//”

Single Slash “/” – 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 “//” – 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.

What is the difference between Absolute Path and Relative Path?

Absolute XPath starts from the root node and ends with desired descendant element’s node. It starts with top HTML node and ends with input node. It starts with a single forward slash(/) as shown below.
Relative XPath starts from any node in between the HTML page to the current element’s node(last node of the element). It starts with a single forward slash(//) as shown below.

What is the difference between Assert and Verify in Selenium?

one of the most important question from selenium interview questions

Assert: In simple words, if the assert condition is true then the program control will execute the next test step but if the condition is false, the execution will stop and further test step will not be executed.
Verify: In simple words, there won’t be any halt in the test execution even though the verify condition is true or false.
For detailed post check the below link.

What are Soft Assert and Hard Assert in Selenium?

Soft Assert: Soft Assert collects errors during @Test Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement
Hard Assert: Hard Assert throws an AssertException immediately when an assert statement fails and test suite continues with next @Test

What are the verification points available in Selenium?

In Selenium IDE, we use Selenese Verify and Assert Commands as Verification points
In Selenium WebDriver, there is no built-in features for verification points. It totally depends on our coding style. some of the Verification points are
To check for page title
To check for certain text
To check for certain element (text box, button, drop down, etc.)

How to launch a browser using Selenium WebDriver?

WebDriver is an Interface. We create Object of a WebDriver Interface.
<2.53 – no geckodriver
3.x – geckodriver for FF
To launch Firefox Driver:WebDriver driver = new FirefoxDriver();
To launch Chrome Driver:WebDriver driver = new ChromeDriver();
To launch Internet Explorer Driver:WebDriver driver = new InternetExplorerDriver();

Is the FirefoxDriver a Class or an Interface?

FirefoxDriver is a Java class, and it implements the WebDriver interface.

How to find more than one web element in the list?

One of the most important very frequently asked question from selenium interview questions

// To store the list

List <WebElement> eleList = driver.findElements(By.xpath(“xpath”));

// To fetch the size of the list

int listSize = eleList.size();

//for loop

for (int i=0; i<listSize; i++)


                // Clicking on each link


                // Navigating back to the previous page that stores the links



What is the super interface of WebDriver?


How to mouse hover on a web element using WebDriver?

one of the most important question from selenium interview questions

By using Actions class

WebElement ele = driver.findElement(By.xpath(“xpath”));

//Create object ‘action’ of an Actions class

Actions action = new Actions(driver);

//Mouseover on an element


Also Check Most Important Java Interview Questions and Answers

Explain the line of code Webdriver driver = new FirefoxDriver(); ?

‘WebDriver‘ is an interface and we are creating an object reference of type WebDriver instantiating an object of FirefoxDriver class.

We do create a reference variable ‘driver’ of type WebDriver
WebDriver driver = new FirefoxDriver();
instead of creating
FirefoxDriver driver = new FirefoxDriver();
WebDriver driver = new FirefoxDriver(); instead of creating FirefoxDriver driver = new FirefoxDriver();

How can we handle web based pop-up?

To handle alerts popups we need to do switch to the alert window and call Selenium WebDriver Alert API methods.

What is the purpose of doing this way?

we create a reference variable driver of type WebDriver then we could use the same driver variable to work with any browser of our choice such as IEDriver, SafariDriver etc.,
//FirefoxDriver driver = new FirefoxDriver();
ChromeDriver driver = new ChromeDriver();
WebDriver driver = new FirefoxDriver();

What are the different exceptions you have faced in Selenium WebDriver?

• WebDriverException
• TimeoutException
• NoAlertPresentException
• NoSuchWindowException
• NoSuchElementException
• StaleElementReferenceException
• IllegalStateException

How To Login Into Any Site If It Is Showing Any Authentication Pop-Up For Username And Password?

To do this we pass username and password with the URL

What are the types of waits available in Selenium WebDriver?

one of the most important question from selenium interview questions

In Selenium we could see three types of waits such as Implicit Waits, Explicit Waits and Fluent Waits.
• Implicit Waits –
• Explicit Waits –
• Fluent Waits –
• PageLoadTimeOut
• Thread.sleep() – static wait

Also Check Manual Testing Interview Questions & Answers

What is Implicit Wait In Selenium WebDriver?

Implicit waits tell to the WebDriver to wait for a certain amount of time before it throws an exception. Once we set the time, WebDriver will wait for the element based on the time we set before it throws an exception. The default setting is 0 (zero). We need to set some wait time to make WebDriver to wait for the required time.

How can we handle windows based pop up?

Selenium doesn’t support windows based applications. It is an automation testing tool which supports only web application testing. We could handle windows based popups in Selenium using some third party tools such as AutoIT, SIKULI, Robot class etc.

What are the benefits of Automation Testing?

  • Saves time and money. Automation testing is faster in execution.
    • Reusability of code. Create one time and execute multiple times with less or no maintenance.
    • Easy reporting. It generates automatic reports after test execution.
    • Easy for compatibility testing. It enables parallel execution in the combination of different OS and browser environments.
    • Low-cost maintenance. It is cheaper compared to manual testing in a long run.
    • Automated testing is more reliable.
    • Automated testing is more powerful and versatile.
    • It is mostly used for regression testing. Supports execution of repeated test cases.
    • Minimal manual intervention. Test scripts can be run unattended.
    • Maximum coverage. It helps to increase the test coverage.

Also Check Most Important ISTQB Interview Questions & Answers

What type of tests have you automated?

Our main focus is to automate test cases to do Regression testing, Smoke testing, and Sanity testing. Sometimes based on the project and the test time estimation, we do focus on End to End testing.

How many test cases you have automated per day?

It depends on Test case scenario complexity and length. I did automate 2-5 test scenarios per day when the complexity is limited. Sometimes just 1 or fewer test scenarios in a day when the complexity is high.

Also Check Software Testing Career FAQs

What is a Framework?

This is most important question from selenium interview questions, 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

selenium interview questions

Have you created any Framework?

If you are a beginner: No, I didn’t get a chance to create a framework. I have used the framework which is already available.
If you are an experienced tester: Yes, I have created a framework. Or I have involved in the creation of the framework.

Can you explain the Framework which you have used in your Selenium Project?

one of the most important question from selenium interview questions, Here we have clearly explained each component of Framework.

Why do you prefer Selenium Automation Tool?
• Free and open source
• Have large user base and helping communities
• Cross browser compatibility
• Platform compatibility
• Multiple programming languages support

What is Selenium?

one of the most important question from selenium interview questions, Selenium is an open source (free) automated testing suite to test web applications. It supports different platforms and browsers. It has gained a lot of popularity in terms of web-based automated testing and giving a great competition to the famous commercial tool HP QTP (Quick Test Professional) AKA HP UFT (Unified Functional Testing).
Selenium is a set of different software tools. Each tool has a different approach in supporting web based automation testing.
It has four components namely,

  1. Selenium IDE (Integrated Development Environment)
  2. Selenium RC (Remote Control) – selenium 1
  3. Selenium WebDriver – selenium 2 & 3
  4. Selenium Grid

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 Selenese?

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

Which is the only browser that supports Selenium IDE to be used?


What is Selenium RC?

Selenium RC AKA Selenium 1. Selenium RC was the main Selenium project for a long time before the WebDriver merge brought up Selenium 2. Selenium 1 is still actively supported (in maintenance mode). It relies on JavaScript for automation. It supports Java, Javascript, Ruby, PHP, Python, Perl and C#. It supports almost every browser out there.

What is Selenium WebDriver?

Selenium WebDriver AKA Selenium 2 is a browser automation framework that accepts commands and sends them to a browser. It is implemented through a browser-specific driver. It controls the browser by directly communicating with it. Selenium WebDriver supports Java, C#, PHP, Python, Perl, Ruby.

What is Selenium Grid?

Selenium Grid is a tool used together with Selenium RC to run tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems.
In simple words, it is used to distribute your test execution on multiple platforms and environments concurrently.

When do you use Selenium Grid?

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

What are the advantages of Selenium Grid?

It allows running test cases in parallel thereby saving test execution time.
It allows multi-browser testing
It allows us to execute test cases on multi-platform

What is a hub in Selenium Grid?

A hub is a server or a central point that controls the test executions on different machines.

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 are the types of WebDriver APIs available in Selenium?

• Firefox Driver
• Gecko Driver
• InternetExplorer Driver
• Chrome Driver
• Opera Driver
• Safari Driver
• Android Driver
• iPhone Driver
• EventFiringWebDriver

You can check Selenium official website here

Frequently Asked Selenium Interview Questions

What is WebDriver Wait In Selenium WebDriver?

one of the most important question from selenium interview questions
WebDriverWait is applied on a certain element with defined expected condition and time. This wait is only applied to the specified element. This wait can also throw an exception when an element is not found.

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.

Can I navigate back and forth in a browser in Selenium WebDriver?

We use Navigate interface to do navigate back and forth in a browser. It has methods to move back, forward as well as to refresh a page.
driver.navigate().forward(); – to navigate to the next web page with reference to the browser’s history
driver.navigate().back(); – takes back to the previous webpage with reference to the browser’s history
driver.navigate().refresh(); – to refresh the current web page thereby reloading all the web elements
driver.navigate().to(“url”); – to launch a new web browser window and navigate to the specified URL

What is the difference between driver.close() and driver.quit() methods?

The Purpose of these two methods (driver.close and driver.quit) is almost same. Both allow us to close a browser but still, there is a difference.
driver.close(): To close current WebDriver instance
driver.quit(): To close all the opened WebDriver instances

How to select a value in a dropdown?

By using Select class
WebElement mySelectElement = driver.findElement(“dropdown”));
Select dropdown = new Select(mySelectElement);


Avinash is the Founder of Software Testing Sapiens. He is a blogger and Software Tester who has been helping people to get thier Jobs over a years Now.

Leave a Comment

Copy link