Slide 1
Most trusted JOB oriented professional program
DevOps Certified Professional (DCP)

Take your first step into the world of DevOps with this course, which will help you to learn about the methodologies and tools used to develop, deploy, and operate high-quality software.

Slide 2
DevOps to DevSecOps – Learn the evolution
DevSecOps Certified Professional (DSOCP)

Learn to automate security into a fast-paced DevOps environment using various open-source tools and scripts.

Slide 2
Get certified in the new tech skill to rule the industry
Site Reliability Engineering (SRE) Certified Professional

A method of measuring and achieving reliability through engineering and operations work – developed by Google to manage services.

Slide 2
Master the art of DevOps
Master in DevOps Engineering (MDE)

Get enrolled for the most advanced and only course in the WORLD which can make you an expert and proficient Architect in DevOps, DevSecOps and Site Reliability Engineering (SRE) principles together.

Slide 2
Gain expertise and certified yourself
Azure DevOps Solutions Expert

Learn about the DevOps services available on Azure and how you can use them to make your workflow more efficient.

Slide 3
Learn and get certified
AWS Certified DevOps Professional

Learn about the DevOps services offered by AWS and how you can use them to make your workflow more efficient.

previous arrow
next arrow

Top 50 selenium interview questions and answers

Spread the Knowledge
Selenium interview questions and answers

1) What is Selenium and what is composed of?

Selenium is a suite of tools for automated web testing. It is composed of

Selenium IDE (Integrated Development Environment) : It is a tool for recording and playing back. It is a firefox plugin
WebDriver and RC: It provide the APIs for a variety of languages like Java, .NET, PHP, etc. With most of the browsers Webdriver and RC works.
Grid: With the help of Grid you can distribute tests on multiple machines so that test can be run parallel which helps in cutting down the time required for running in browser test suites.

2) How will you find an element using Selenium?

In Selenium every object or control in a web page is referred as an elements, there are different ways to find an element in a web page they are

PartialLink Text
Xpath etc

3) List out the test types that are supported by Selenium?

For web based application testing selenium can be used

The test types can be supported are

a) Functional, Learn More about Functional Testing.

b) Regression

For post release validation with continuous integration automation tool could be used

a) Jenkins

b) Hudson

c) Quick Build

d) CruiseCont

4) List out the test types that are supported by Selenium?

For web based application testing selenium can be used

The test types can be supported are

a) Functional, Learn More about Functional Testing.

b) Regression

For post release validation with continuous integration automation tool could be used

a) Jenkins

b) Hudson

c) Quick Build

d) CruiseCont

5) Explain what is assertion in Selenium and what are the types of assertion?

Assertion is used as a verification point. It verifies that the state of the application conforms to what is expected. The types of assertion are “assert” , “verify” and “waitFor”.

6) Mention 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.

Refer Complete Guide on XPath

7) Explain the difference between single and double slash in X-path?

Single slash ‘/ ’

Single slash ( / ) start selection from the document node
It allows you to create ‘absolute’ path expressions
Double Slash ‘// ’

Double slash ( // ) start selection matching anywhere in the document
It enables to create ‘relative’ path expressions

8) List out the technical challenges with Selenium?

Technical challenges with Selenium are

Selenium supports only web based applications
It does not support the Bitmap comparison
For any reporting related capabilities have to depend on third party tools
No vendor support for tool compared to commercial tools like HP UFT
As there is no object repository concept in Selenium, maintainability of objects becomes difficult

9) What is the difference between type keys and type commands?

TypeKeys() will trigger JavaScript event in most of the cases whereas .type() won’t. Type key populates the value attribute using JavaScript whereas .typekeys() emulates like actual user typing

10) What is the difference between verify and assert commands?

Assert: Assert allows to check whether an element is on the page or not. The test will stop on the step failed, if the asserted element is not available. In other words, the test will terminated at the point where check fails.

Verify: Verify command will check whether the element is on the page, if it is not then the test will carry on executing. In verification, all the commands are going to run guaranteed even if any of test fails.

11) What is JUnit Annotations and what are different types of annotations which are useful?

In JAVA a special form of syntactic meta-data can be added to Java source code, this is know as Annotations. Variables, parameters, packages, methods and classes are annotated some of the Junit annotations which can be useful are


12) While using click command can you use screen coordinate?

To click on specific part of element, you would need to use clickAT command. ClickAt command accepts element locator and x, y co-ordinates as arguments-

clickAt (locator, cordString)

13) What are the advantages of Selenium?

It supports C#, PHP, Java, Perl, Phython
It supports different OS like Windows, Linux and Mac OS
It has got powerful methods to locate elements (Xpath, DOM , CSS)
It has highly developer community supported by Google

14) Why testers should opt for Selenium and not QTP?

Selenium is more popular than QTP as

Selenium is an open source whereas QTP is a commercial tool
Selenium is used specially for testing web based applications while QTP can be used for testing client server application also
Selenium supports Firefox, IE, Opera, Safari on operating systems like Windows, Mac, Linux etc. however QTP is limited to Internet Explorer on Windows.
Selenium supports many programming languages like Ruby, Perl, Python whereas QTP supports only VB script

15) What are the four parameter you have to pass in Selenium?

Four parameters that you have to pass in Selenium are

Port Number

16) What is the difference between setSpeed() and sleep() methods?

Both will delay the speed of execution.

Thread.sleep () : It will stop the current (java) thread for the specified period of time. Its done only once

It takes a single argument in integer format
Ex: thread.sleep(2000)- It will wait for 2 seconds

It waits only once at the command given at sleep
SetSpeed () : For specific amount of time it will stop the execution for every selenium command.

It takes a single argument in integer format
Ex: selenium.setSpeed(“2000”)- It will wait for 2 seconds

Runs each command after setSpeed delay by the number of milliseconds mentioned in set Speed
This command is useful for demonstration purpose or if you are using a slow web application

17) What is same origin policy? How you can avoid same origin policy?

The “Same Origin Policy” is introduced for security reason, 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.

To avoid “Same Origin Policy” proxy injection method is used, in proxy injection mode the Selenium Server acts as a client configured HTTP proxy , which sits between the browser and application under test and then masks the AUT under a fictional URL

18) What is heightened privileges browsers?

The purpose of heightened privileges is similar to Proxy Injection, allows websites to do something that are not commonly permitted. The key difference is that the browsers are launced in a special mode called heightened privileges. By using these browser mode, Selenium core can open the AUT directly and also read/write its content without passing the whole AUT through the Selenium RC server.

19) How you can use “submit” a form using Selenium?

You can use “submit” method on element to submit form-

element.submit () ;

Alternatively you can use click method on the element which does form submission

20) What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?

TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of testing needs, from Unit Testing to Integration Testing. And the functionality which makes it efficient testing framework are

Support for annotations
Support for data-driven testing
Flexible test configuration
Ability to re-execute failed test cases

21) What are the advantages of automation testing?

Some basic Advantages of automation testing are as follows.

Automation testing supports both functional and performance test on an application.
It supports the execution of repeated test cases.
It facilitates parallel execution.
It aids in testing a large test matrix.
It improves accuracy because there are no chances of human errors.
It saves time and money.

22) Name some of the commonly used Automation Testing tools that are used for Functional Automation.

Lists of top 10 used automation testing tools for Functional Automation are as follows.

Teleric Test Studio, Developed by Teleric.
HPE Unified Functional Testing (HP – UFT formerly QTP)
Tosca Testsuite
Quick Test Professional, provided by HP.
Rational Robot, provided by IBM.
Coded UI, provided by Microsoft.
Selenium, open source.
Auto It, Open Source.

23) Name some of the commonly used Automation Testing tools that are used for Non-Functional Automation.

Lists of some commonly used Automation Testing tools for Non-Functional Automation are as follows.

Load Runner, provided by Hp.
JMeter, provided by Apache.
Burp Suite, provided by PortSwigger.
Acunetix, provided by Acunetix.

24) What is Selenium?

Selenium is a portable framework for software testing. Selenium tool facilitates with a playback tool for authoring functional tests without the need to learn a test scripting language.

Selenium is one of the most widely used open source Web UI (User Interface) automation testing suite. Jason Huggins developed Selenium in 2004 as an internal tool at Thought Works. Selenium supports automation across different browsers, platforms, and programming languages.

25) What are the different components of Selenium?

Selenium is not just a single tool but a suite of software’s, each having a different approach to support automation testing. It comprises of four major components which include:

Selenium Integrated Development Environment (IDE)
Selenium Remote Control (Now Deprecated)
Selenium Grid

26) List out the names of programming languages, browsers and operating systems that are supported by Selenium.

Selenium supports various operating systems, browsers and programming languages. Following is the list:

Programming Languages: C#, Java, Python, PHP, Ruby, Perl, JavaScript.
Operating Systems: Android, iOS, Windows, Linux, Mac, Solaris.
Browsers: Google Chrome, Mozilla Firefox, Internet Explorer, Edge, Opera, Safari, etc.

27) What are the significant changes/upgrades in various Selenium versions?

Selenium v1.0:

Version 1.0 was the initial release of Selenium.
It included three tools: Selenium IDE, Selenium RC, and Selenium Grid.
Selenium v2.0:

Selenium WebDriver was introduced replacing Selenium RC in version “2.0”.
With the onset of WebDriver, RC got deprecated and moved to the legacy package.
Selenium v3:

The latest release Selenium 3 has new added features and functionalities.
It includes Selenium IDE, Selenium WebDriver, and Selenium Grid.

28) List some of the test types that are supported by Selenium.

Different types of testing’s that we can achieve through Selenium are.

Functional Testing
Regression Testing
Sanity Testing
Smoke Testing
Responsive Testing
Cross Browser Testing
UI testing (black box)
Integration Testing

29) What is Selenium IDE?

Selenium IDE is implemented as Firefox extension which provides record and playback functionality on test scripts. It allows testers to export recorded scripts in many languages like HTML, Java, Ruby, RSpec, Python, C#, JUnit and TestNG.

Selenium IDE has limited scope, and the generated test scripts are not very robust, and portable.

30) What do you mean by Selenese?

Selenium commands, also known as “Selenese” are the set of commands used in Selenium that run your tests. For example, command – open (URL); launches the desired URL in the specified browser and it accept both relative and absolute URLs.

A sequence of Selenium commands (Selenese) together is known as a test script.

31) What are the different ways of locating a web element in Selenium?

In Selenium, web elements are identified and located with the help of Locators. Locators specify a target location which uniquely defines the web element in the context of a web application. Thus, to identify web elements accurately and precisely we have different types of locators in Selenium:

CSS Selector

32) How many types of WebDriver API’s are available in Selenium?

The list of WebDriver API’s which are used to automate browser include:


33) List out some of the Automation tools which could be integrated with Selenium to achieve continuous testing.

Selenium can be used to automate functional tests and can be integrated with automation test tools such as Maven, Jenkins, &Docker to achieve continuous testing. It can also be integrated with tools such as TestNG, &JUnit for managing test cases and generating reports.

34) What do you mean by the assertion in Selenium?

The assertion is used as a verification point. It verifies that the state of the application conforms to what is expected. The types of assertion are “assert”, “verify” and “waitFor”.

35) Explain the difference between assert and verify commands?

Assert: Assert command checks if the given condition is true or false. If the condition is true, the program control will execute the next phase of testing, and if the condition is false, execution will stop, and nothing will be executed.

Verify: Verify command also checks if the given condition is true or false. It doesn’t halt program execution, i.e., any failure during verification would not stop the execution, and all the test phases would be executed.

36) What do you mean by XPath?

XPath is also defined as XML Path. It is a language used to query XML documents. It is an important approach to locate elements in Selenium. XPath consists of a path expression along with some conditions. Here, we can easily write XPath script/query to locate any element in the webpage. It is developed to allow the navigation of XML documents. The key factors that it considered while navigating are selecting individual elements, attributes, or some other part of an XML document for specific processing. It also produces reliable locators. Some other points about XPath are as follows.

XPath is a language used for locating nodes in XML documents.
XPath can be used as a substitute when you don’t have a suitable id or name attribute for the element you want to locate.
XPath provides locating strategies like:
XPath Absolute
XPath Attributes

37) Explain XPath Absolute and XPath attributes.

XPath Absolute:

XPath Absolute enables users to mention the complete XPath location from the root HTML tag to the specific elements.
Syntax: //html/body/tag1[index]/tag2[index]/…/tagN[index]
Example: //html/body/div[2]/div/div[2]/div/div/div/fieldset/form/div[1]/input[1]
XPath Attributes:

XPath Attributes is always recommended when you don’t have a suitable id or name attribute for the element you want to locate.
Syntax: //htmltag[@attribute1=’value1′ and @attribute2=’value2′]
Example: //input[@id=’passwd’ and @placeholder=’password’]

38) What is the difference between “/” and “//” in XPath?

Single Slash “/”: Single slash is used to create XPath with absolute path.

Double Slash “//”: Double slash is used to create XPath with the relative path.

39) What are the different types of annotations which are used in Selenium?

JUnit annotations which can be used are:


40) What are the WebDriver supported Mobile Testing Drivers?

WebDriver supported “mobile testing drivers” are:


41) Which browsers/drivers are supported by Selenium Webdriver?

Some commonly used browsers supported by Selenium are-

Google Chrome – ChromeDriver
Firefox – FireFoxDriver
Internet Explorer – InternetExplorerDriver
Safari – SafariDriver
HtmlUnit (Headless browser) – HtmlUnitDriver
Android – Selendroid/Appium
IOS – ios-driver/Appium

42) Can we test APIs or web services using Selenium Webdriver?

No. Selenium WebDriver uses the browser’s native method to automate the web applications. So, there is no support for testing web services using Selenium WebDriver.

43) What are the various ways of locating an element in Selenium?

The different locators in Selenium are-

CSS selector
link text

44) How can we inspect the web element attributes in order to use them in different locators?

In order to locate web elements, we can use the Developer tool and plugins like Firebug.
The developer tool can be launched by pressing F12 on the browser. Users can easily hover over any element and find its different HTML properties.

Firebug is a plugin of Firefox that provides various development tools for debugging applications. From an automation perspective, Firebug is used specifically for inspecting web elements in order to find their attributes like id, class, name, etc. in different locators.

45) What is an XPath?

Xpath or XML path is a query language that is used for selecting nodes from XML documents. Also, it is one of the locators supported by Selenium Webdriver.

46) What is an absolute XPath?

An absolute XPath is a way of locating an element using an XML expression, beginning from the root node i.e. HTML node in the case of web pages.

The main disadvantage of absolute XPath is that even if there is a slight change in the UI or any element then also whole XPath will fail.
Example – html/body/div/div[2]/div/div/div/div[1]/div/input

47) How can we move to the parent of an element using XPath?

Using ‘/..’ after the XPath expression of the child element, we can move to the parent of an element.
For example, the locator //div[@id=”childId”]/.. will move to the parent of the div element with id value as ‘childId’.

48) How can we move to the nth-child element using XPath?

Basically, there are two ways of navigating to the nth element using XPath-

Using square brackets with index position-
Example – div[2] will find the second div element.
Using position()-
Example – div[position()=3] will find the third div element.

49) What is the syntax of finding elements by id using CSS Selector?

By using #idValue in the CSS locator, we can select all the elements belonging to a particular class e.g. ‘#userId’ will select the element having an id – userId.

50) How can we select elements by their attribute value using the CSS Selector?

Using [attribute=value] in the CSS locator, we can select all the elements belonging to a particular class e.g. ‘[type=small]’ will select the element having attribute type of value ‘small’.

Related video:

Rajesh Kumar
Latest posts by Rajesh Kumar (see all)
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x