Selenium Automation Tester

60+ Selenium Automation Tester Interview Questions and Answers

Updated 18 Oct 2024

Popular Companies

search-icon

Q1. How to get the count of all text box in a web page?

Ans.

To get the count of all text boxes in a web page, we can use Selenium's findElements() method with the input type 'text'.

  • Use Selenium's findElements() method to find all elements with the input type 'text'

  • Count the number of elements returned by the findElements() method

  • Return the count as the result

Q2. Selenium Question

Why should Selenium be selected as a testing tool for web applications or systems?

Q3. Automation Testing Question

What are the different parts of a test automation framework?

Q4. Selenium Question

What is meant by XPath in Selenium. Explain XPath Absolute and XPath Relative.

Are these interview questions helpful?
Q5. Automation Testing Question

What are some of the best practices in test automation?

Q6. Cucumber Question

How can you run a selected test from a group of tests in Cucumber?

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q7. Automation Testing Question

How do you automate the testing of CAPTCHA?

Q8. Selenium Question

What are the different components of Selenium?

Selenium Automation Tester Jobs

Automation Selenium Tester (Java Development) • 5-10 years
Cognizant
•
3.8
Indore
Automation Tester - Selenium/Appium (4-6 yrs) • 4-6 years
Onward Technologies Limited
•
3.2
â‚ą 12 L/yr - â‚ą 18 L/yr
Capgemini - Python Automation Tester - Selenium (3-10 yrs) • 3-10 years
Capgemini
•
3.8
â‚ą 5 L/yr - â‚ą 25 L/yr
Q9. Software Testing Question

What do you mean by Data flow testing?

Q10. Software Testing Question

What is boundary value analysis?

Q11. How to reduce execution time in selenium?

Ans.

To reduce execution time in Selenium, optimize test scripts, use efficient locators, and run tests in parallel.

  • Optimize test scripts by removing unnecessary steps and reducing wait times

  • Use efficient locators such as CSS selectors instead of XPath

  • Run tests in parallel using tools like Selenium Grid or TestNG

  • Use headless browsers like PhantomJS to speed up tests

  • Use page object model to reduce code duplication and improve maintainability

Q12. BDD Question

Explain briefly how Behavioral Driven Development(BDD) works?

Q13. Selenium Question

Explain what are the JUnits annotation linked with Selenium?

Q14. Software Testing Question

Write the difference between Test Stub and Test Driver.

Q15. Cucumber Question

What is grouping in the context of Cucumber?

Q16. Difference between Scenario & Scenario Outline in Cucumber?

Ans.

Scenario is a single test case while Scenario Outline is a template for multiple test cases.

  • Scenario is a single test case that describes a particular behavior of the system

  • Scenario Outline is a template for multiple test cases with placeholders for input values

  • Scenario Outline uses Examples table to provide input values for each test case

  • Scenario Outline reduces code duplication and makes test cases more maintainable

Q17. Automation Testing Question

What is Protractor?

Q18. Selenium Question

Difference between Selenium and Cucumber.

Q19. How to upload resume using Selenium

Ans.

To upload resume using Selenium, use sendKeys() method to locate the file input element and pass the file path.

  • Locate the file input element using any of the locators like id, name, class, etc.

  • Use sendKeys() method to pass the file path to the file input element.

  • Click on the submit button to upload the file.

Q20. 1. Difference between overloading and Overriding 2. Explain POM and it's Advantage 3. Is Java pure object oriented programming language? 4. can we override constructor? 5. have you used overriding and overloadi...

read more
Ans.

Answers to common interview questions for Selenium Automation Tester position

  • Overloading is when a class has multiple methods with the same name but different parameters, while overriding is when a subclass provides a specific implementation for a method that is already defined in its superclass.

  • POM (Page Object Model) is a design pattern in Selenium automation testing where web pages are represented as classes, and the web elements on the page are defined as variables within...read more

Q21. Difference between red only and constants?

Ans.

Red only is a type of constant used in Selenium to locate web elements based on their color.

  • Red only is used to locate elements that have a specific color, such as a red button.

  • Constants are variables that hold a fixed value and are used in Selenium to make code more readable and maintainable.

  • Red only is a type of constant that holds the value 'red' and is used in conjunction with other locators, such as ID or class name.

Q22. 1)Diff between continue and break ? 2)what is maven3)write code for extent report

Ans.

1) continue - skips the current iteration and continues with the next iteration in a loop. break - exits the loop immediately. 2) Maven is a build automation tool used primarily for Java projects. 3) Extent Report is a reporting library for Selenium test automation.

  • continue statement is used to skip the current iteration and continue with the next iteration in a loop

  • break statement is used to exit the loop immediately

  • Maven is a build automation tool that manages project depen...read more

Q23. Explain implicit and explicit wait?

Ans.

Implicit wait is a global wait applied to all elements, while explicit wait is a specific wait applied to a particular element or condition.

  • Implicit wait is set once and applied to all elements in the script

  • Explicit wait is set for a specific element or condition

  • Implicit wait is defined at the driver level

  • Explicit wait is defined at the element level

  • Implicit wait is used to wait for elements to appear on the page

  • Explicit wait is used to wait for a specific condition to occur

  • I...read more

Q24. Software Testing Question

Explain STLC.

Q25. 5.How to do right click using Selenium?

Ans.

To perform right click using Selenium, we can use the Actions class and its contextClick() method.

  • Create an instance of Actions class

  • Use the contextClick() method to perform right click

  • Pass the WebElement on which right click needs to be performed as argument

  • Use build() and perform() methods to execute the action

Q26. How many types of locators, type of xpath

Ans.

There are 8 types of locators in Selenium: ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, CSS Selector, XPath.

  • ID - locates elements by their ID attribute

  • Name - locates elements by their Name attribute

  • Class Name - locates elements by their Class attribute

  • Tag Name - locates elements by their HTML tag name

  • Link Text - locates elements by the exact text of a link

  • Partial Link Text - locates elements by a partial match of the link text

  • CSS Selector - locates elements u...read more

Q27. Code: take your name as input and print every letter separately and if any vowel is repeated print those vowels.

Ans.

The code takes a name as input, prints each letter separately, and identifies repeated vowels.

  • Create a function that takes a string input for the name

  • Iterate through each letter in the name and print it separately

  • Track the vowels and check for repetitions to print repeated vowels

Q28. Explain collections, Framework used?

Ans.

Collections are used to store and manipulate groups of objects. Frameworks used in Selenium automation testing include TestNG, JUnit, and Cucumber.

  • Collections are used to store and manipulate groups of objects

  • Frameworks used in Selenium automation testing include TestNG, JUnit, and Cucumber

Q29. How to drag and drop using Selenium

Ans.

To drag and drop using Selenium, we can use the Actions class and its dragAndDrop() method.

  • Create an instance of Actions class

  • Use the dragAndDrop() method to specify the source and target elements

  • Perform the action using the build() and perform() methods

Q30. Given a set of strings, swap pair of character in each string. Eg “Selenium Automation Testing” should print as “eselinmu uaotamitno ettsnig”

Ans.

Swap pair of characters in each string of an array of strings.

  • Iterate through each string in the array

  • For each string, swap pairs of characters by iterating through the string with a step of 2

  • Return the modified array of strings

Q31. Given a set of strings, find out the duplicate characters for the entire list of strings.

Ans.

Find duplicate characters in a set of strings.

  • Iterate through each string in the array.

  • For each string, iterate through each character and store them in a hashmap with their frequency.

  • Identify characters with frequency greater than 1 as duplicates.

Q32. how to extend thread class in java

Ans.

To extend Thread class in Java, we need to create a new class and inherit it from the Thread class.

  • Create a new class and inherit it from the Thread class

  • Override the run() method to define the task that the thread will perform

  • Instantiate the new class and call the start() method to start the thread

Q33. How to achieve multiple inheritance in java

Ans.

Multiple inheritance is not supported in Java due to the Diamond Problem, but can be achieved using interfaces.

  • Java does not support multiple inheritance of classes due to the Diamond Problem

  • Multiple inheritance can be achieved in Java using interfaces

  • Create multiple interfaces with desired methods and implement them in a single class

Q34. 4.How do you catch exception?

Ans.

To catch exceptions, we use try-catch block in our code.

  • Wrap the code that may throw an exception in a try block.

  • Catch the exception in a catch block and handle it appropriately.

  • Multiple catch blocks can be used to handle different types of exceptions.

  • Finally block can be used to execute code regardless of whether an exception was thrown or not.

Q35. Background keyword in Cucumber? Use of it?

Ans.

Background keyword is used to define steps that are common to all scenarios in a feature file.

  • Background keyword is used to reduce code duplication in feature files.

  • It is defined at the beginning of a feature file, before any scenarios.

  • Steps defined in the background section are executed before each scenario in the feature file.

  • It is useful for setting up preconditions or initializing data that is required for all scenarios.

  • Example: Given a user is logged in, When they naviga...read more

Q36. How to configure jenkins?

Ans.

Jenkins can be configured by installing plugins, creating jobs, setting up build triggers, and configuring global settings.

  • Install necessary plugins for required functionality

  • Create jobs for each project with build steps and post-build actions

  • Set up build triggers such as polling or webhook

  • Configure global settings such as security and email notifications

  • Use Jenkinsfile for pipeline as code

  • Example: Install Git plugin, create a job with build step to clone repository, set up w...read more

Q37. How to read properties File How to take screenshot

Ans.

To read properties file, use Java Properties class. To take screenshot, use Selenium WebDriver's TakesScreenshot interface.

  • To read properties file, create an object of Properties class and load the file using FileInputStream.

  • To take screenshot, cast WebDriver object to TakesScreenshot and call getScreenshotAs method.

Q38. 2.OOps concepts in your framework

Ans.

Object-oriented programming concepts are used in our framework.

  • Encapsulation is used to hide implementation details and expose only necessary information.

  • Inheritance is used to reuse code and create a hierarchy of classes.

  • Polymorphism is used to allow objects of different classes to be treated as if they are of the same class.

  • Abstraction is used to simplify complex systems by breaking them down into smaller, more manageable parts.

  • Examples include creating classes for pages, e...read more

Q39. What is explicit and implicit wait

Ans.

Explicit wait is defined by the user to wait for a certain condition to be met before proceeding, while implicit wait is set globally for the entire test script.

  • Explicit wait is used for specific elements and conditions, like waiting for an element to be clickable or visible.

  • Implicit wait is set once at the beginning of the test script and is applied to all elements, waiting for a specified amount of time before throwing an exception.

  • Explicit wait provides more control and fl...read more

Q40. Explain interface

Ans.

An interface is a contract between two entities that defines the communication between them.

  • An interface defines a set of methods that a class must implement.

  • It provides a way to achieve abstraction and loose coupling.

  • Interfaces can be used to achieve multiple inheritance in Java.

  • Example: Java's Comparable interface defines a method to compare objects.

  • Example: Selenium WebDriver interface defines methods to interact with web elements.

Q41. What is assert in TestNG?

Ans.

Assert is a TestNG keyword used to verify the expected and actual results of a test case.

  • Assert is used to validate the expected output of a test case

  • If the expected and actual results do not match, the test case fails

  • Assert can be used for various types of validations such as checking for equality, null values, exceptions, etc.

  • Examples: assertEquals, assertNull, assertTrue, etc.

Q42. BDD and cucumber framework with selenium

Ans.

BDD and Cucumber are frameworks used for behavior-driven development and test automation respectively with Selenium.

  • BDD is a collaborative approach to software development that involves stakeholders in the process

  • Cucumber is a tool that supports BDD by allowing stakeholders to write scenarios in plain language

  • Selenium is a popular tool for automating web browsers

  • Cucumber can be integrated with Selenium to automate tests based on BDD scenarios

Q43. Difference between findElement and findElements.

Ans.

findElement returns the first matching element on the web page, while findElements returns a list of all matching elements.

  • findElement returns a single WebElement matching the specified locator, while findElements returns a list of WebElements.

  • findElement throws NoSuchElementException if no matching element is found, while findElements returns an empty list.

  • Example: WebElement element = driver.findElement(By.id("username"));

  • Example: List elements = driver.findElements(By.clas...read more

Q44. Write code to read excel file

Ans.

Code to read excel file in Selenium

  • Use Apache POI library to read excel files in Selenium

  • Create a FileInputStream object to read the excel file

  • Use WorkbookFactory to create a Workbook object from the FileInputStream

  • Iterate through the rows and cells of the excel sheet to read data

Q45. 1. Find the second non repetitive character

Ans.

The second non-repetitive character is to be found in a given array of strings.

  • Iterate through each character in the strings and count their occurrences

  • Identify the characters that occur only once

  • Return the second non-repetitive character

Q46. Largest number in array, Java program

Ans.

Java program to find the largest number in an array of strings

  • Convert each string element in the array to an integer using Integer.parseInt()

  • Initialize a variable to store the largest number and compare each element to update it

  • Return the largest number found in the array

Q47. write xpath for makemy trip application

Ans.

XPath for locating elements on MakeMyTrip application

  • Use unique attributes like id, class, name, etc. to create XPath

  • Avoid using indexes in XPath as they can be unreliable

  • Use contains() and starts-with() functions for dynamic attributes

  • Consider using parent-child relationships for complex structures

Q48. Define SDLC in software Testing

Ans.

SDLC stands for Software Development Life Cycle, which is a process followed by software development teams to design, develop, and test high-quality software.

  • SDLC is a structured approach to software development that involves planning, designing, building, testing, and deploying software.

  • It consists of several phases, including requirements gathering, design, development, testing, deployment, and maintenance.

  • Each phase has its own set of activities and deliverables, which mus...read more

Q49. Java program for reverse number

Ans.

Java program to reverse a number

  • Convert the number to a string

  • Use StringBuilder to reverse the string

  • Convert the reversed string back to a number

Q50. What is Fluent Wait?

Ans.

Fluent Wait is a dynamic wait mechanism in Selenium that waits for a certain condition to be met before proceeding.

  • Fluent Wait is used to define the maximum amount of time to wait for a condition, as well as the frequency with which to check the condition.

  • It can be customized with different polling intervals and exceptions to ignore.

  • Example: WebDriverWait wait = new WebDriverWait(driver, 10); wait.pollingEvery(Duration.ofSeconds(2)); wait.ignoring(NoSuchElementException.class...read more

1
2
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
3.7
 • 7.3k Interviews
3.8
 • 5.4k Interviews
3.8
 • 2.8k Interviews
3.6
 • 2.3k Interviews
3.4
 • 1.3k Interviews
3.7
 • 866 Interviews
3.8
 • 545 Interviews
5.0
 • 1 Interview
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Selenium Automation Tester Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

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

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter