Top 25 Selenium Interview Questions and Answers in 2024

Editorial Team

Selenium Interview Questions and Answers

Selenium is a powerful automated testing tool used by several software developers worldwide. It performs automatic testing, saving many professionals from manual testing, which has many disadvantages. Since we are committed to helping you ace your upcoming Selenium-related job interview, we will cover some of the questions you should expect.

Keep in mind that most of these questions will be technical. Therefore, our article will focus more on the practical and technical aspects of Selenium. Take a look at the following and ensure that you have all the answers at your fingertips when appearing before the panel:

1. Selenium Supports 2 Testing Types. Can You Mention Them?

The two testing types that one can do with Selenium are regression and functional testing. Regression testing is done on already executed test cases and can either be full or partial. The already executed test cases are re-executed in this case to ensure that all the functionalities are in their best states. The test takes place in three stages: re-testing, regression test selection, and prioritization of test cases.

On the other hand, functional testing verifies all application’s functions with a given specification. The software developer will first have to identify the test inputs, compute their outcomes, execute the test, and compare the outcome with both outcomes.

2. Mention The Limitations Of Selenium Testing

Despite its usefulness in the software development life cycle, Selenium testing also has disadvantages. First, it only tests web applications and has to be integrated with tools such as Appium for desktop or mobile applications. This testing tool does not have reliable tech support, given that it is open-source. It offers limited support for image testing, lacks an in-built reporting and test management facility, and requires basic programming knowledge.

3. Selenium Has Four Suite Components. Could You Please Mention Them?

For the Suite Components, Selenium comes with Selenium IDE, Selenium WebDrive, Selenium Grid, and Selenium Web Control, popularly known as SRC. The Selenium Grid simultaneously distributes commands to various machines, allowing parallel text executions in various browsers and operating systems. At the same time, WebDrive acts as the programming interface for creating and running test cases. The IDE speeds up the automation script creation process while the Remote-Control component permits the writing of applications in different programming languages.

4. You Have Used Selenium 2.0 And 3.0 Versions. Can You Tell The Difference?

Selenium 3.0 is just an extended version of the 2.0. It doesn’t rely on Selenium RC for backward compatibility and has several bug fixes. It is also more stable, which makes it a better version than the former. All in all, both get the work done if used properly.

5. Define What Selenese Is And How To Classify It

Selenese is a collection of Selenium commands used to test web applications. It allows testers or software development teams to test broken links, Ajax functionality, window, alerts, list options, and an object in on the user interface, among many others. These commands are actions that directly interact with the application, accessors that allow users to store given values to a defined variable, and assertions, which verify an application’s current state with the expected state.

6. Why Do You Think Most Software Dev Teams Prefer Selenium?

There are several reasons why Selenium is the best option for several dev teams. It is easy to use as it is built on JavaScript; it can test web applications against several browsers such as Chrome and Opera and permits tests coded to be written in different programming languages. Teams also appreciate that Selenium works independently of the platform and can be integrated with various third-party apps.

7. What Are The Different Types Of Web Locators In Selenium?

Selenium has eight web locators that function as commands. They direct Selenium IDE on the GUI elements that need an operation and specify the exact area. They include locator by a partial link where the target link is located using a portion of text in a link text element, locator by name, which returns the first element with the name attribute of a similar value to the location, and locator by Tagname that identifies elements using the value of their CLASS attribute. Other locators are locator by a classmate, locator by XPath, locator by CSS selector, locator by ID, and locator by the line.

8. Selenium Has Same-Origin Policy. Can You Tell Us How It Is Done?

The same-origin policy is a security feature that bars a malicious script on a given page from accessing sensitive data on another. A web browser can only allow scripts from one webpage to access another if both pages have a similar origin. In this case, the origin is a combination of the hostname, port number and URL scheme. For example, a JavaScript program used by cannot access pages from domains such as

9. Webdriver Is An Important Suite Components Of Selenium. Mention The Types Of Waits It Supports

The WebDriver supports three main waits. These are Implicit wait,which commands the automated testing tool to wait for a given duration before giving a ‘no such element’ exception; fluent wait,which communicates to the web driver commanding it to wait for a given condition and frequency of checking the condition before giving an “ElementNotVisibleException’ answer, and the explicit wait that commands the Web Driver to wait for given conditions before an ‘ElementNotVisibleException.’

10. Define Automation Testing And Mention Some Of Its Benefits

Automating testing, commonly known as test automation, involves automating the manual process, empowering it to test a given application or system. A separate testing tool must be involved for automation testing to be successful. The tool will allow the creation of test scripts to be repeatedly executed without any manual effort. Some of the benefits of automation testing include: It enables parallel execution, saves time and resources, helps test a large test matrix, reduces human-generated errors and thus improves accuracy and lastly, encourages unattended execution, given that it does not require any human intervention.

11. Differentiate Between Assert And Verify Commands In Selenium

As the name implies, the assert command confirms whether a given condition is true or false. It can assert if an element is on the webpage or not before communicating to the program control. The program control executes the next step if the reply is true or stops execution for a false condition, limiting any further test. The verify command does the same; just that program execution does not stop whether the condition is true or false. All the steps will be executed as planned, as any verification failure does not impact the execution.

12. Define An Xpath

An XPath uses an element’s XML path to locate it. The XML, the short form for the extensible markup language, stores, organizes and transports arbitrary data in a key-value pair similar to HTML tags. Since both are markup languages under the same umbrella, the Xpath is empowered to locate HTML elements. A user can easily find an element by referring to another. It is also worth mentioning that the Xpath has a single and double slash. The double slash creates Xpath with a relative path, while the single slash creates the Xpath with an absolute path.

13. Mention The Different Types Of Navigation Commands In Xpath

There are four types of navigation commands in Xpath. They include the navigate()and forward() command that allows users to navigate to the next web page after referring to the browser’s history the navigate(). The refresh () command lets users refresh a particular webpage by reloading the web elements. At the same time, the navigateto() command empowers users to launch new web browser windows to a specified URL. We also have the navigate()back command that does not require any parameter but returns a user to the previous webpage, based on the web browser history.

14. Mention The Junit Annotations

There are six Junit Annotations. @test informs the system that the given annotated method is a test method. A single test script can have several test methods. @ignore informs the system that the mother cannot be executed, and @afterclass tells the system that the method will be executed after any test method. @after shows that it will be executed repeatedly after the execution of each test method. @before communicates to the system the consistent execution of a method before each test method. Lastly, the @bwfore calls annotation shows that a method will only be executed once before the other test methods.

15. Define What Testng Is And Tell Us Whether You Find It Better Than Junit

TestNG benefits developers and testers, making it one of the most advanced frameworks in the software development cycle. It is an open-source framework licensed by Apache Software and can be easily downloaded for use. It works easily with Selenium’s WebDriver to offer a fast and efficient test result format that can be shared with different project stakeholders. Another important feature is the in-built exception handling mechanism that allows a program to run without unexpected termination. This framework is better than Junit because it allows testers and developers to set execution patterns and comes with additional easy and advanced annotations. It also allows editingtest case dependencies and the concurrent execution of different test scripts.

16. Differentiate Between Selenium And QTP

The differences between Selenium and QTP lie in their distribution, browser compatibility, language and vendor support, object repository and test applications. Selenium is better on browser compatibility as it supports almost every popular browser while Quick Test professional only supports Internet Explorer, Chrome and Firefox. Selenium has the upper hand on the distribution property as it is an open-source, freely available tool, while QTP is a licensed commercialized tool. On test applications, QTP loses as it allows both web and window-based application testing while Selenium only supports web-based application testing. On language supports, Selenium supports more languages as opposed to QTP. Lastly, Seleniumdoes not offer vendor support, given that it is a free tool, which is different from QTP.

17. Walk Us Through How To Create An Object Repository In Selenium

An object repository refers to the web elements ofan application under test. It also includes the locator values,often populated from the object repository whenever an element is needed within a given script. It acts as a centralized location or storing locators, saving developers from hard coding them within a script. Seleniumallows objects to be stored in an Excel sheet to be populated inside a given script on demand.

18. Define A Test Framework And List The Different Types That Exist

A test framework is a collection of different coding standards, guidelines, processes, practices, concepts, modularity reporting mechanisms, test data injection and project hierarchies, among many others used for automation testing. There are different types of frameworks, such as the module-based testing frameworks, keyword-driven test frameworks, hybrid testing frameworks, library architecture testing frameworks, data-driven testing frameworks and behavior-driven development frameworks, all of which operate differently.

19. Seleniumhas The Driver.Close() And Driver.Quit Command. Can You Differentiate The Two?

The close () method supported by WebDriver is used to close the browser window a user is currently working on or which is being accessed by the web driver. It does not need any parameter and does not return any value. On the other hand, the quit () method closes the window opened by the program. However, just like the former, it does not need any parameter and doesn’t return any value.

20. Mention The Advantages Of Automated Testing

Automation Testing hasseveral advantages that software development teams from all over the world enjoy. It saves teams time and money when testing application, helps to handle large-scale matrices, makes a system more accurate and efficient as it reduces manual intervention, allows test cases to be executed in a parallel manner and allows the execution of repeated test cases. It also plays a big role in systems and applications’ performance and functional testing.

21. Mention The Advantages Of Selenium

Selenium has positively impacted the performance of different software dev teams thanks to its advantages. It is compatible with several browsers, including Safari, making it a handy tool when conducting simultaneous multi-browser testing of an application. It also allows teams to test on a variety of devices. You can automate tests easily on an Android or iOS device. This open-source automation tool also supports several programming languages, giving it the edge over its competitors. Lastly, it is compatible with almost all operating systems, giving it the versatility needed in software development. This tool will run on Mac OS X, Windows, Linux and UNIX.

22. Can You Tell Us The Basic Steps Of Selenium Testing?

Selenium testing occurs in even easy steps. First, an instance of a WebDriver must be created using the constructor of the targeted browser. Its purpose is to invoke methods and access other interfaces. The next step is to navigate to the webpage to be tested. While on the page, one needs to locate an HTML element using the different locators and interact with it. The fifth step is to anticipate the browser response from your interaction and then run tests based on the results using a test framework. The last step is to conclude the test by invoking the quit method on the driver variable.

23. Mention The Advantages Of A Page Object Model

The page object model, also known as the POM, generates an object repository for web user interface elements. It is a design pattern that comes in handy in test automation. It has several advantages, which explains its importance in automation testing. This model gives methods more realistic names for easy association with the user interface operation. It also lessens and makes codes more efficient, given the reusable page methods found in its classes. Lastly, it makes codes clearer and easy to understand, given that UI activities and flows are normally separated from verification.

24. What Do You Know About Jenkins?

Jenkins is one of the most powerful open-source continuous integration technologies for software dev teams. This cross-platform works with different operating systems, which explains its popularity. It helps keep track of different jobs, including Apache Subversion and can be installed through a direct installation file or a war file that deploys it through the application server. It can also be configured to run automated tests builtin TestNg after every SVN build. Jenkins also makes it easier to set up several tasks, making it an efficient tool. Fortunately, it can be used with Selenium.

25. Why Do Automation Teams And Testers Use Jenkins With Selenium?

Jenkins complements the already-useful Selenium. You will have the liberty to run your Selenium tests after every program change run on Jenkins. It also allows saving the test reports and execution history of Selenium tests. You can develop and test projects in continuous integration, provided you also use Maven. Lastly, Jenkins allows the execution of tests at predetermined times.


These are some questions you should expect in your upcoming Selenium-based interview. Make sure you familiarize yourself with all the technical aspects of this automation tool before your interview. We wish you well and hope that you will get the job.