Selenium Automation

30+ Selenium Automation Interview Questions and Answers

Updated 16 Jul 2025
search-icon

Asked in Wipro

4d ago

Q. Write a program to remove duplicate character in a string if there are multiple users in an application, and if the buttons in the applications are specific to particular user, you need to perform operation in...

read more
Ans.

Questions related to Selenium Automation and software testing

  • To remove duplicate characters in a string, use a loop and a hashset

  • To perform operations on specific buttons for a user, use conditional statements

  • To switch to a particular tab, use the window handle

  • 500 error code in Postman validation indicates a bad request

  • Primary key is a unique identifier for a record in a database

  • Roles and responsibilities in a project depend on the project and team

Asked in Wipro

2d ago

Q. If a page has two login buttons, will they have the same ID?

Ans.

No, the two login buttons should not have the same ID.

  • IDs should be unique for each element on a page

  • Having two elements with the same ID can cause issues with locating and interacting with the elements

Asked in Wipro

3d ago

Q. How will you retrieve all the values from the drop down?

Ans.

To retrieve all values from a drop down, we can use the getOptions() method and store the values in an array of strings.

  • Locate the drop down element using any of the locators

  • Create a Select class object by passing the drop down element as a parameter

  • Use the getOptions() method to retrieve all the options from the drop down

  • Store the options in an array of strings

Asked in Wipro

3d ago

Q. How do you write the step execution report/result in the report?

Ans.

Use TestNG or JUnit framework to generate step execution report/result.

  • Use TestNG or JUnit annotations to mark the start and end of each test step.

  • Use TestNG or JUnit listeners to capture the test results and generate the report.

  • Use reporting libraries like ExtentReports or ReportNG to generate detailed reports with screenshots and logs.

Are these interview questions helpful?

Q. How do you execute a feature file in parallel in a BDD Cucumber Framework?

Ans.

To execute feature files in parallel in BDD Cucumber Framework, we can use tools like Maven Surefire plugin or Cucumber-JVM-Parallel-Plugin.

  • Use Maven Surefire plugin to run tests in parallel by adding and tags in pom.xml file

  • Use Cucumber-JVM-Parallel-Plugin to run tests in parallel by adding @CucumberOptions(plugin = {"json:target/cucumber-report/cucumber.json", "com.github.temyers:cucumber-jvm-parallel-plugin:5.0.0"}, threads = 3) annotation in the runner class

  • Ensure that ...read more

Asked in Wipro

1d ago

Q. How do you switch to the second window using the page title?

Ans.

To switch to the second window using page title, we can use getWindowHandles() and switchTo() methods.

  • Use getWindowHandles() method to get all the window handles

  • Iterate through the window handles and switch to the desired window using switchTo() method

  • Use getTitle() method to get the title of each window and compare it with the desired title

Selenium Automation Jobs

Virtusa Consulting Services Pvt Ltd logo
Selenium Automation 8-13 years
Virtusa Consulting Services Pvt Ltd
3.7
Gurgaon / Gurugram
Litmus7 Systems Consulting logo
QA Selenium Automation Testing RPA 10-20 years
Litmus7 Systems Consulting
4.0
Kochi
GLOBALFOUNDRIES Engineering Private Limited logo
Java Selenium Automation Testing 2-4 years
GLOBALFOUNDRIES Engineering Private Limited
3.4
Bangalore / Bengaluru

Asked in Accenture

2d ago

Q. Types of xpaths, project structure, cucumber dry run option, testing basic annotations, difference between interface and abstract class, what are the concepts of oops

Ans.

Answering questions related to Selenium Automation

  • Types of xpaths: Absolute and Relative

  • Project structure: Follows a modular approach

  • Cucumber dry run option: Used to check feature file syntax

  • Testing basic annotations: @Test, @BeforeTest, @AfterTest

  • Difference between interface and abstract class: Interface has only method declarations, abstract class has both method declarations and implementations

  • Concepts of OOPS: Inheritance, Polymorphism, Encapsulation, Abstraction

Q. How do you handle multiple popups in Selenium?

Ans.

To handle multiple popups in Selenium, we can use getWindowHandles() and switchTo() methods.

  • Use getWindowHandles() method to get all the window handles

  • Switch to the desired window using switchTo() method

  • Perform actions on the popup window

  • Switch back to the main window using switchTo() method

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q. How do you retrieve all options from a dropdown menu?

Ans.

To get all options in a dropdown, use the getOptions() method and store the values in an array of strings.

  • Locate the dropdown element using any of the locators

  • Create a Select class object by passing the dropdown element as a parameter

  • Use the getOptions() method to get all the options in the dropdown

  • Store the options in an array of strings

Asked in Wipro

5d ago

Q. What collections are used in the framework?

Ans.

Collections like ArrayList, HashMap, HashSet are commonly used in Selenium framework.

  • ArrayList is used to store a list of elements

  • HashMap is used to store key-value pairs

  • HashSet is used to store unique elements

  • Collections class is used for sorting and searching

Asked in Accenture

4d ago

Q. What is the mother of all classes?

Ans.

There is no such thing as 'mother of all classes' in Selenium Automation.

  • There is no concept of 'mother of all classes' in Selenium Automation.

  • It is possible that the interviewer is asking a trick question or trying to test the candidate's knowledge.

  • The candidate should politely ask for clarification or context before attempting to answer.

  • If the interviewer insists on an answer, the candidate can explain that there is no such thing and provide examples of important classes in...read more

Asked in Wipro

6d ago

Q. What is the difference between a simple Java program and a Maven project?

Ans.

A simple Java program is a standalone program while a Maven project is a build automation tool.

  • A simple Java program is compiled and executed using the command line or an IDE.

  • A Maven project uses a pom.xml file to manage dependencies and build the project.

  • A simple Java program may require manual management of dependencies.

  • A Maven project can easily manage dependencies and build the project with a single command.

  • A simple Java program may not have a defined project structure.

  • A ...read more

Q. How do you send credentials via URL?

Ans.

Credentials can be sent via URL by appending them to the URL as query parameters.

  • Append the username and password as query parameters to the URL

  • Encode the username and password using Base64 encoding

  • Example: http://example.com/login?username=admin&password=encoded_password

Q. How do you scroll a page to a desired location?

Ans.

To scroll page to desired location, use JavaScriptExecutor and scrollTo() method.

  • Create an instance of JavaScriptExecutor

  • Use executeScript() method to execute scrollTo() method

  • Pass the desired location as arguments to scrollTo() method

  • Example: ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

Q. What is the difference between Explicit wait and Fluent Wait?

Ans.

Explicit wait waits for a specific condition while Fluent wait waits for a condition with polling interval.

  • Explicit wait waits for a specific condition to occur before proceeding further

  • Fluent wait waits for a condition with a polling interval and ignores exceptions

  • Explicit wait is used when we know the condition and the maximum time to wait for it

  • Fluent wait is used when we don't know the maximum time to wait for a condition

  • Example of explicit wait: WebDriverWait wait = new ...read more

Q. How do you initialize a Chrome driver?

Ans.

To initialize Chrome driver, create an instance of ChromeDriver class.

  • Create an instance of ChromeDriver class

  • Set the path of ChromeDriver executable file

  • Use the instance to interact with the browser

Asked in AlphaSense

2d ago

Q. What is webdriver and webelement

Ans.

WebDriver is a tool for automating web applications. WebElement is an interface representing an HTML element.

  • WebDriver is a browser automation tool used to control the browser and interact with web elements

  • WebElement is an interface representing an HTML element on a web page

  • WebDriver interacts with web elements using the WebElement interface

  • Examples of web elements include buttons, text fields, and links

Asked in Wipro

3d ago

Q. Why are tags used in Cucumber?

Ans.

Tags are used in Cucumber to organize and filter scenarios and features.

  • Tags allow for easy organization of scenarios and features based on their purpose or functionality.

  • Tags can be used to filter which scenarios or features are run during a test.

  • Tags can be added to scenarios or features using the '@' symbol followed by the tag name.

  • Tags can also be used to pass parameters to step definitions.

  • Examples: @smoke, @regression, @login, @api, etc.

Asked in TCS

6d ago

Q. What are constructors?

Ans.

Constructors are special methods that are used to initialize objects in a class.

  • Constructors have the same name as the class.

  • They are called automatically when an object is created.

  • They can be used to set default values for object properties.

  • Constructors can be overloaded to accept different parameters.

  • Example: public class Car { public Car() { // constructor code here } }

Asked in Wipro

3d ago

Q. How do you disable a test?

Ans.

To disable a test, we can comment out the test code or use testNG annotations.

  • Comment out the test code

  • Use testNG annotations like @Test(enabled=false)

  • Use testNG XML file to disable the test

  • Use groups to disable a set of tests

Asked in Wipro

3d ago

Q. What are the key differences between TestNG and JUnit?

Ans.

TestNG is more advanced and flexible than JUnit, with features like parallel testing and data-driven testing.

  • TestNG supports parallel testing while JUnit does not.

  • TestNG allows for data-driven testing while JUnit does not.

  • TestNG has more advanced annotations and reporting features than JUnit.

  • TestNG can be used with both Java and non-Java languages while JUnit is only for Java.

  • JUnit is simpler and easier to learn than TestNG.

5d ago

Q. What is the super interface in WebDriver?

Ans.

A super interface in Selenium WebDriver is an interface that extends multiple interfaces.

  • A super interface allows a class to inherit methods and variables from multiple interfaces.

  • It provides a way to achieve multiple inheritance in Java.

  • For example, the WebDriver interface is a super interface that extends multiple interfaces like SearchContext and TakesScreenshot.

Asked in AlphaSense

6d ago

Q. Expected conditions in selenium

Ans.

Expected conditions are pre-defined conditions that can be used to wait for a certain state or element in Selenium.

  • ExpectedConditions.elementToBeClickable() - waits for an element to be clickable

  • ExpectedConditions.visibilityOfElementLocated() - waits for an element to be visible

  • ExpectedConditions.titleContains() - waits for the page title to contain a certain text

4d ago

Q. What reporting tools are available in Selenium WebDriver?

Ans.

There are several reporting tools available for Selenium WebDriver.

  • TestNG

  • JUnit

  • ExtentReports

  • Allure Reports

  • Custom reporting using log4j or Apache log4j

1d ago

Q. What are the different types of locators in Selenium?

Ans.

Locators are used in Selenium Automation to identify elements on a web page.

  • ID Locator: Uses the 'id' attribute of an element

  • Name Locator: Uses the 'name' attribute of an element

  • Class Name Locator: Uses the 'class' attribute of an element

  • Tag Name Locator: Uses the HTML tag name of an element

  • Link Text Locator: Uses the text of a link element

  • Partial Link Text Locator: Uses a partial text of a link element

  • CSS Selector Locator: Uses CSS selectors to identify elements

  • XPath Locator...read more

Asked in AlphaSense

1d ago

Q. How do you wait for a file to load using Selenium?

Ans.

To wait for file loading in Selenium Automation, we can use explicit wait or thread.sleep() method.

  • Explicit wait is used to wait for a specific condition to occur before proceeding with the next step.

  • Thread.sleep() method is used to pause the execution for a specified amount of time.

  • We can also use the ExpectedConditions class to wait for a file to be loaded.

  • Waiting for a file to be loaded is important to ensure that the file is available for further processing.

Asked in Accenture

2d ago

Q. How do you handle multiple windows in Selenium?

Ans.

Multi-window handling in Selenium involves managing multiple browser windows or tabs during automation testing.

  • Use driver.getWindowHandles() to get all window handles.

  • Switch to a specific window using driver.switchTo().window(windowHandle).

  • To close a window, use driver.close() and switch back to the original window.

  • Example: After opening a new tab, switch back to the main window using driver.switchTo().window(originalWindowHandle).

Asked in Wipro

4d ago

Q. How does priority work in TestNG?

Ans.

Priority in TestNG determines the order in which test methods are executed.

  • Priority can be set using the 'priority' attribute in @Test annotation

  • Default priority is 0, higher priority is executed first

  • Priority can be negative as well

  • If two methods have the same priority, they are executed in alphabetical order

Asked in Infosys

4d ago

Q. What are the different types of waits in Selenium?

Ans.

Waits are used to synchronize the test execution with the application's response.

  • Implicit Wait

  • Explicit Wait

  • Fluent Wait

  • Thread.sleep()

  • WebDriverWait

Asked in Innovaccer

2d ago

Q. What are the different types of waits available in Selenium?

Ans.

Selenium waits are crucial for handling dynamic web elements during automation testing.

  • Implicit Wait: Sets a default wait time for the entire session. Example: driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

  • Explicit Wait: Waits for a specific condition to occur before proceeding. Example: WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(ExpectedConditions.visibilityOf(element));

  • Fluent Wait: Similar to explicit wait but allows polling at regular ...read more

Interview Experiences of Popular Companies

Accenture Logo
3.7
 • 8.7k Interviews
Wipro Logo
3.7
 • 6.1k Interviews
Capgemini Logo
3.7
 • 5.1k Interviews
PwC Logo
3.3
 • 1.4k Interviews
View all

Top Interview Questions for Selenium Automation Related Skills

Interview Tips & Stories
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Selenium Automation Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits