'Coding has over 700 languages', '67% of programming jobs aren’t in the technology industry', 'Coding is behind almost everything that is powered by electricity'
Last Updated: Dec 28, 2023

Top 50+ Selenium Interview Questions and Answers (2023)

Author Bijay Kumar
0 upvote
Interview guide for product based companies
Free guided path
12 chapters
99+ problems
Earn badges and level up


Selenium is a free and open-source automation framework. Its primary use is validating web-based applications over several browsers and devices. It is also capable of automating web-based administration operations. It is the most popular web automation framework.

We have provided a curated list of the most frequently asked Selenium interview questions and answers. This article will provide you with valuable tips to help you succeed in your next Interview. Let’s explore the most asked Selenium interview questions and answers which are categorized into different categories i.e. 

  • Selenium Interview Questions for Freshers
  • Selenium Interview Questions for Experienced
  • Selenium WebDriver Interview Questions
  • Selenium MCQ Questions
Selenium Interview Questions

We have provided a curated list of the most frequently asked Selenium interview questions and answers. This article will provide you with valuable tips to help you succeed in your next Interview. Let’s explore the most asked Selenium interview questions and answers which are categorized into three categories i.e. Selenium Interview Questions for Freshers and experienced.

Selenium Interview Questions for Freshers

1. What is Selenium?

Selenium is an automated testing framework that is free and open-sourced, which allows testers to write and execute automated tests for web applications across various browsers and platforms. It provides a suite of software tools that cater to different testing needs, including Selenium IDE, Selenium Remote Control, WebDriver, and Selenium Grid. Selenium supports multiple programming languages and can be used to validate the functionality of web applications. Overall, Selenium is a widely used tool for web application testing due to its flexibility, compatibility, and ease of use. 

2. What are the advantages of automation testing?

The primary advantages of automation testing include the followings:
→ It covers both functional and regression testing of web applications.
→ Because automated execution of test cases is faster than manual execution, automated testing enhances coverage.
→ It helps in the parallel execution of different testing tasks.
→ It improves accuracy by eliminating the possibility of human error.
→ It enables you to save both time and money.

3. What are the different components of Selenium?

Selenium is a well-known automated testing framework. It's a playback tool that allows you to perform functional testing without writing test scripts. Selenium is a web UI-based automation testing package that is open-source. 
It has four major components:
→ Selenium Integrated Development Environment (IDE)
→ Selenium Remote Control
→ WebDriver
→ Selenium Grid

4. What are the limitations of Selenium?

The limitations of Selenium are as follows:
→ It only works for web-based applications; it cannot test Windows or Android applications.
→ Selenium is dependent on third-party applications for reporting purposes.
→ It can not handle captcha and barcodes.
→ Selenium has issues with handling frames and pop-up windows.

5. What is the testing automation of different programming languages, browsers and operating systems that Selenium supports?

The Selenium framework supports many systems, browsers and languages. 
→ Programming Languages: JavaScript (Node. js), Java, Ruby, Python, Kotlin, and C#.
→ Operating systems: Linux, Microsoft Windows, macOS
→ Browsers: Chrome, Firefox, Microsoft Edge, Opera Browser, Safari.

Click on the following link to read further: Javascript Interview Questions and Answers

6. Describe major upgrades/changes in different Selenium versions.

Following are the significant changes in different versions of the Selenium framework:

Different Selenium Versions

7. What is Selenese?

The commands used to execute Selenium tests are commonly known as "Selenese." We use these Selenese commands to test web applications. One can verify the existence of UI elements by looking at their HTML tags. Selenium uses “commands” to determine what actions or activities to do.
Example: open(URL), is used to open the URL in the specified browser.

8. Explain different ways of locating a web element in Selenium.

In Selenium, Locators are used to identify and locate web items. In the context of a web application, locators define a unique target position for a web element. Different type of locators used in Selenium are as follows:
ID: find_element_by_id
Class name: find_element_by_class_name
Xpath: find_element_by_xpath
Link text: find_element_by_link_text
Attribute name: find_element_by_name
Partial link text: find_element_by_partial_link_text
HTML tag name: find_element_by_tag_nameb

9. Explain the policy of same-origin and how Selenium handles it.

The Same Origin policy is a security feature. It allows a web browser to run scripts from one webpage to access the contents of another webpage till both pages have the exact origin. The origin is the combination of the URL scheme, hostname, and port number. This policy prevents sensitive information on one website from being compromised by another website.

10. What do you mean by the assertion in Selenium?

Asserts in Selenium are application validations or checkpoints. Assertions assert confidently that the application's behaviour is as expected. ‘Asserts’ in Selenium validate test cases, as the name implies. They assist testers in determining if tests have passed or failed. "assert," "verify," and "waitFor" are the three kinds of assertions. 

11. Explain the difference between assert and verify commands?

Assert: The assert command determines whether or not the provided condition is true. If the condition is true, the programme control will proceed to the next testing phase. Execution will halt if the condition is false.
→ Verify: The verify command also determines whether or not the provided condition is true. It does not halt programme execution, i.e., if there is a failure during verification, the programme will continue to run, and all test phases will be complete.

12. What is XPath in Selenium?

The term XPath is an alternative name to XML Path. It's an XML querying language. It's a crucial method for locating Selenium's elements. XPath allows testers to browse through any document's XML structure, and it works on both HTML and XML documents. 
There are two different types of XPath in Selenium.
1. Absolute Path (Complete path to the element)
2. Relative Path (Starts with a double slash which signifies a break in the absolute path)

Read about,  Wordpress Interview Questions

13. What is the difference between “/” and “//” in XPath?

Single Slash “/” - The single slash generates an Xpath with an absolute path, which means the XPath will start selection from the document node/start node.
→ Double Slash "//" - The double slash constructs an Xpath with a relative path. This means the XPath can start selection from anywhere on the page.

14. What are the different annotations used in Selenium?

JUnit Annotations- Test, BeforeClass, AfterClass, Before, After, Ignore, RunWith
→ TestNG Annotations- BeforeSuite, BeforeTest, BeforeClass, BeforeMethod, Test, AfterMethod, AfterClass, AfterTest.

15. What are the WebDriver-supported Mobile Testing Drivers?

Various WebDriver for mobile testing by Selenium are:

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Selenium Interview Questions for Experienced

16. What is the difference between "type keys" and "type" commands?

Type: When you need to enter text into an input field, type is used in the same way as a human enters a value. 
→ Type Keys: typeKeys simulates each keystroke. When a page performs an action while you enter, such as autosuggest in search fields, it uses this tag.

17. What's the difference between findElement() and findElements()?

findElement(): Using the provided "locating technique", this function locates the first element on the current page. It gives back a single WebElement.
→ findElements(): This function uses the provided "locating technique" to locate all of the elements on the current page. It gives you a list of web elements.

18. What is Selenium Grid?

Selenium Grid allows you to simultaneously distribute your tests across numerous machines. As a result, using the same test script, you can run tests on Internet Explorer on Windows and Safari on Mac. It shortens test execution time and gives immediate feedback.

19. In Selenium WebDriver, how do we launch different browsers?

We must first build an instance of that browser's driver as shown below:
WebDriver driver = new ChromeDriver();
In this scenario, "WebDriver" is an interface, and we're establishing a reference variable "driver" of type WebDriver, which instantiates the "ChromeDriver" class.

20. What kinds of waits are there in WebDriver?

In WebDriver, there are two sorts of waits:

Implicit Wait: Implicit waits establish a default waiting period (say, 30 seconds) between each successive test step/command across the whole test script. As a result, the next test step would not run until 30 seconds since the previous test step/command executes.

Explicit Wait: An explicit wait halts the execution until a specific condition or the maximum time has elapsed. Unlike implicit waits, explicit waits apply to only one instance.

21. How to Enter Text into a Textbox Using Selenium?

To enter the string into the textbox, the user can use sendKeys("Some strings here").|
WebElement emailid = drv.findElement(By.id(“mailbox”));

22. How can we obtain the text of a web element?

The get command accesses the inner text of a web element. The command takes no parameters and returns a string value. It is also one of the most commonly used commands for verifying messages, labels, errors, and other information presented on web pages.
String Sometext = driver.findElement(By.id(“Example”)).getText();

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

The close() method of the WebDriver shuts the web browser window that the user is currently working on or the window that the WebDriver is currently accessing. The command does not accept any parameters and does not return any value.
Unlike the close() method, the quit() method shuts all windows that the programme has opened. Like the close() method, the command does not require any parameters and does not return any value.

24. How can we deal with pop-ups based on Windows?

Selenium is an automation testing tool that only enables web application testing; it does not support testing of Windows applications. However, while Selenium cannot alleviate the matter on its own, it is overcome with the support of a third party. Along with Selenium, there are various third-party solutions available for managing window-based pop-ups, such as AutoIT, Robot class, and so on.

25. What is TestNG, and how is it superior to Junit?

TestNG is a sophisticated framework designed to benefit developers and testers. With the introduction of frameworks, JUnit gained massive popularity among Java applications, Java developers, and Java testers, significantly enhancing code quality. Despite its ease of use and simplicity, JUnit has restrictions that necessitate the inclusion of TestNG. TestNG is an open-source framework that is freely available for download under the Apache Software License.
TestNG with WebDriver provides an efficient and effective test result format that is communicated with stakeholders to provide a snapshot of the product's/health/ application's hence overcoming the disadvantage of WebDriver's inability to generate test results.

There are several advantages of using TestNG over JUnit. Among them are:
a. Advance and simple annotations included.
b. It is possible to develop execution patterns.
c. Execution of test scripts at the same time.
d. It is possible to define test case dependencies.

26. What exactly is an Object Repository? In Selenium, how can we construct an Object Repository?

The phrase "Object Repository" refers to a collection of web elements belonging to the Application Under Test (AUT) as well as their locator values. As a result, the location value may be fetched from the Object Repository whenever the script uses the element. Instead of hardcoding locators into scripts, Object Repository stores them in a centralised location.

An excel sheet saves the object in Selenium, which can then be populated within the script as needed.

27. What types of frameworks in Selenium are there?

Some of the important frameworks are as follows:

Data-driven framework This type of test data is created from external files such as Excel, CSV, XML, etc. The data about the test cases rely on input and verification values kept via variables.
Framework based on keywords The data tables and keywords are created separately from the automated test cases. The functionality of the test scenarios is documented step by step in the table in this framework.
Module-based testing framework The application under test is divided into isolated and logical modules. Each module has its own set of test scripts. These scripts are then combined as a whole.
Behavior-driven testing framework The test scripts are constructed in such a way that automation is performed on the functionality or features to assure readability, understanding, and reliability to either business experts, developers, or other testers.
Hybrid testing framework A Hybrid testing framework is a combination of more than one of the frameworks mentioned above that leverage the benefits of each.

28. What types of tests does Selenium support?

Selenium enables both regression and functional testing.
Regression testing is the re-execution of a full or partial set of previously executed test cases to confirm that current functionality continues to function correctly. 
The steps are as follows:
a. Re-testing: All of the tests in the existing test suite are rerun. It turns out to be quite costly and time-consuming.
b. Regression test selection: Tests are of three types: feature tests, integration tests, and end-to-end tests. Some of the test selections occur in this step.
c. Prioritisation of test cases: Test cases are prioritized based on their business effectiveness and essential functionalities.

Functional testing entails verifying that every application function meets the needed specifications. The steps involved are as follows:
a. Determine the test input.
b. Calculate the test result.
c. Carry out the test.
d. Contrast the test result with the actual result.

29. In the Selenium IDE, how can you debug the tests?

The steps to debug the tests in Selenium IDE are:
a. We must first place breakpoints to debug and execute the test step by step.
b. Run the test case afterward.
c. Following that, the execution terminates at the breakpoint.
d. You can continue the execution of all the commands consecutively by clicking the Run button.

30. What are regular expressions, and how can you use them in Selenium?

Regular expressions are specific text strings that represent search patterns. Regexp is a keyword that can be used as a prefix to treat a text as a regular expression in Selenium.



  • It will look for the input tag that has the 'name' property and include the text 'somestring'.
  • Here the method “starts-with()” implies that the string begins with the provided text

31. What are steps for troubleshooting tests using Selenium IDE?

Some steps for troubleshooting tests in Selenium IDE are:

  1. Identify the problem: The first step is to identify and understand the problem.
  2. Check the test case: Once the problem is identified, the second step would be to check the test case itself. One needs to make sure that test cases are written correctly
  3. Check the environment: One needs to make sure the environment they working in set up correctly as it can have an impact on the test result.

32. What is the Actions class in Selenium?

The Actions class is defined in the Selenium Python bindings which are used for automating web browsers. It allows us to perform actions on web elements, like moving the mouse over an element or sending keys to it.

33. What is the meaning of the testng.xml file?

testng.xml is a TestNG configuration file that is used to organize and execute test suites and cases. It helps us to set up for the test executor order, parallel execution, and test data and enables users to understand which methods or classes should be used or not used in a test run.

Selenium WebDriver Interview Questions

34. What is the recommended API for testing databases in conjunction with Selenium WebDriver?

Selenium WebDriver is one of the tools used for automating web browsers though its not designed for database testing. So to test databases, we need a database testing tool that can connect to the database and help perform a number of operations like running SQL queries and getting the results. Some examples of data testing are DBUnit, JDBC, etc.

35. To click on a hyperlink, how would you use Selenium WebDriver?

We use the “click” method on the element to simulate a click on the hyperlink

// Import necessary packages
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

// Create a new instance of the Chrome driver
WebDriver driver = new ChromeDriver();

// Navigate to the web page containing the hyperlink

// Find the hyperlink element by ID
WebElement myLink = driver.findElement(By.id("myLink"));

// Click on the hyperlink

36. How does one use Selenium WebDriver to submit a form?

We use the “get()” method to load the webpage containing the form. Then locate the form element on the web page using one of the locators. Then find the input fields of the form and enter the necessary value using the “sendKeys()” method. And finally, use the “submit()” method to submit the form once all the entries are filled in. Below code snippet gives an example of how the code looks like to submit a from using Selenium Webdriver.

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

// Create a new instance of the Chrome driver
WebDriver driver = new ChromeDriver();

// Load the web page containing the form

// Locate the form element on the web page
WebElement myForm = driver.findElement(By.id("my-form"));

// Find the input fields of the form and enter values
WebElement firstNameField = myForm.findElement(By.id("first-name"));
WebElement lastNameField = myForm.findElement(By.id("last-name"));

// Submit the form


37. How does one enter text into the text box using Selenium Webdriver?

We use the method “sendKeys()” to enter the text in the text box.

textBox.sendKeys("Hello, World!");

38. How does one clear the text from text box in  Selenium WebDriver?

We use the “clear()” method to clear the text. Below code snippet demonstrates how its done.

WebElement textBox = driver.findElement(By.id("my-text-box"));

Read more about: Html interview questions

39. List different types of frameworks and connections using the Robot Framework of Selenium.

  • Keyword-Driven Testing Framework
  • Library Architecture Testing Framework
  • Data-Driven Testing Framework
  • Module-Based Testing Framework
  • Hybrid Testing Framework

40. Is it possible to Windows-based pop-up inside Selenium?

Selenium doesn't support Windows-based pop-ups since Selenium is an automated tool that is built specifically for web application-based testing. However many 3rd party tools support this like Robot Class. 

41. What are the types of waits supported by WebDriver?

There are 3 types of waits that are supported by WebDriver namely:

  1. Implicit Wait: It gives the command to Selenium to wait for a specific amount of time before giving a “No such element” exception
  2. Explicit Wait: It is used to let the WebDriver wait for specific conditions before throwing an “ElementNotVisibleException” exception
  3. Fluent Wait: It is used when one wants to let the WebDriver wait for specific conditions, as well as the frequency by the condition we want to check before it throws an “ElementNotVisibleException”.

42. Name the types of navigation commands in Selenium WebDriver.

driver.navigate().to("https://www.codingninjas.com/") - it helps us navigate the provided URL 

driver.navigate().refresh() - it helps us to refresh the current page

driver.navigate().forward() - it is similar to clicking on the forward button on any browser

driver.navigate().back() - it is similar to clicking on the back button on any browser

42. How would you write the code to launch the Internet Explorer browser in WebDriver? And then navigate it to the official website of Coding Ninjas.

The code we can use to navigate to the Coding Ninjas website through Internet Explorer is as follows:

WebDriver driver = new InternetExplorerDriver();

43. What are the advantages of TestNG?

  • It provides a way for parallel execution.
  • It helps us in checking the actual and the expected test results by providing us with different exertions.
  • We can assign priority to the test methods.
  • We can use it to define the dependent of the test methods over other methods using TestNG

44. What is Hub in Selenium Grid?

Selenium Grid helps us in distributed testing. Using the Selenium Grid, we can run test scripts on multiple machines from different browsers. A Hub is kind of a server or the central point in the Selenium Grid which controls the number of text executions on different machines.

45. In Selenium we have a node in Selenium Grid, what is that node?

A node is a machine that is used in Selenium as an instance which is further connected to the Selenium Grid Hub and runs the test scripts. Although unlike hubs, selenium lattice can have multiple nodes.

46. What mouse functions can be performed using Selenium?

The mouse functions that can be performed are:

  • mouseMove(WebElement element, long xOffset, long yOffset)
  • click(WebElement element)
  • mouseUp(WebElement element)
  • mouseMove(WebElement element, long xOffset, long yOffset)
  • mouseDown(WebElement element)
  • mouseMove(WebElement element)
  • doubleClick(WebElement element)

47. What is the code to double-click an element on the webpage?

The following code describes how one can double-click an element from Selenium:

WebElement element = driver.findElement(By.xpath("yourXpathHere"));
Actions actions = new Actions(driver);


Using Xpath, we locate the element that we are double-clicking on, then created an instance of the Actions class. Then we use doubleClick() method and pass the element in the method and finally use the perform() function to execute the code.

48. In a webpage, how can we be sure that the element is enabled for the interaction?

To know if an element is enabled for interaction on the webpage, we write this code:

WebElement element = driver.findElement(By.xpath("path_of_the_element"));
if(element.isEnabled()) {
    System.out.println("Element is enabled for interaction.");
} else {
    System.out.println("Element is disabled for interaction.");


We have used the isEnabled() methods from the WebElement to check if the element is enabled for the interaction or not. So if the element is enabled to interact it will show us the message printed out as “Element is enabled for interaction.”, otherwise “Element is disabled for interaction.”

49. How does one get the current page URL in Selenium?

To fetch the current page of the URL, we use the following code:

string currentUrl = driver.Url;
Console.WriteLine("Current URL: " + currentUrl);


We have a driver.Url() to get the URL of the current page and then store it in the variable type string currentUrl. Finally the Console.WriteLine helps us to print out the current URL. 

50. How can one retrieve the title of the webpage in Selenium?

We use the driver.getTitle() command, to fetch the page title in Selenium. The output of this code returns a string that contains the title of the webpage.

Must Read Ruby on Rails Interview Questions

Selenium MCQ Questions

In this section of the article “Top 50+ Selenium Interview Questions and Answers (2023)”, we will discuss some important MCQ questions on Selenium. Here are as follows:

1. What is selenium?

  1. Programming Language
  2. Web testing framework
  3. Extension

Answer: B

2. What is the purpose of TestNG?

  1. creating GUI interfaces for Selenium tests.
  2. managing the test data.
  3. parallelizing the test execution.
  4. generating the HTML reports.

Answer: C

3. Choose the programming languages that are commonly used with Selenium?

  1. Python, Java, C#
  2. Ruby, PHP, HTML
  3. JavaScript, C++, Swift
  4. Kotlin, Perl, Objective-C

Answer: A

4. Choose the command that can be used for navigating the specific URL?

  1. open()
  2. navigate()
  3. get()
  4. load()

Answer: C

5. How the screenshot can be taken in the Selenium web driver?

  1. using captureScreenshot() method
  2. using takeScreenshot() method
  3. using saveScreenshot() method
  4. using screenshot() method

Answer: B

6. How the events in the Selenium web driver can be handled?

  1. Using the acceptAlert() method
  2. Using the dismissAlert() method
  3. Using the sendKeys() method
  4. All of the above

Answer: D

7. How the Selenium web driver can refresh the current web page?

  1. refreshPage()
  2. reload()
  3. refresh()
  4. navigate().refresh()

Answer: D

8. How the "enter" key on a keyboard can be pressed by using the command in the selenium web driver?

  1. sendKeys(Keys.ENTER)
  2. pressEnter()
  3. enterKey()
  4. sendKeys(Enter)

Answer: A

9. How can we switch to the i-frame element in selenium web driver?

  1. switchFrame()
  2. selectFrame()
  3. switchToFrame()
  4. switchTo().frame()

Answer: D

10. What does the "executeScript" method use for?

  1. To execute a test case.
  2. To execute JavaScript code in the context of the current browser window.
  3. To generate test reports.
  4. To take a screenshot.

Answer: B

Check this out : Xpath in Selenium

Frequently Asked Questions

Q. What are the 4 major components of Selenium WebDriver?

The 4 major components of Selenium WebDriver are Selenium Client Library (provides programming interfaces), Web Driver Language Bindings (provides additional functionalities to client library), JSON Wire Protocol (provides a common interface to make communications easier), and Browser Drivers (executable files that help WebDriver to communicate with other web browsers.). 

Q. What are the 3 parts of Selenium?

Selenium has three parts: Selenium WebDriver, Selenium IDE, and Selenium Grid. Selenium IDE is used for automating web browsers and allows us to use a programming language to control browsers. Selenium IDE is used to record and playback for Selenium scripts, and no need to have programming knowledge. Selenium Grid is used to run Selenium tests on multiple browsers simultaneously.

Q. Why do we use WebDriver in Selenium?

Basically, WebDriver in Selenium provides the programmatic interface, which is used to automate the web browsers so that interaction with web elements and tests can be performed on the web applications.

Q. What is Selenium used for in QA testing?

Selenium is used for the automation of web browsers with QA testing, which basically helps in regression testing, functional testing, and load testing. It also helps in automating the repetitive tasks.

Q. What is POM Selenium?

POM stands for Page Object Model in the Selenium, which is a design pattern that promotes the structured approach for organizing and maintaining the automated tests by creating the classes.


This article contains all of the Selenium interview questions for freshers and Selenium interview questions and answers for experienced applicants. We hope you found solutions to this article’s most often asked Selenium Interview questions and WebDriver interview questions also. The answers to selenium interview questions presented here are also beneficial in comprehending Selenium fundamentals and advanced WebDriver subjects. 

Check out Top Linux Interview Questions, Selenium Interview Questions, Operating System Interview Questions and Typescript Interview Questions to ace your interviews. Also, check out our JUnit Introduction with Eclipse article if you want to learn more about unit testing. Do upvote our blog to help other ninjas grow.

Head over to our practice platform Coding Ninjas Studio to practise top problems, attempt mock tests, read interview experiences, and much more.!

Happy Reading!

Previous article
Top 30+ Project Manager Interview Questions and Answers
Next article
Salesforce Interview Questions
Guided path
Interview guide for product based companies
12 chapters
123+ Problems
Earn badges and level up
Live masterclass