Automation Tester

80+ Automation Tester Interview Questions and Answers

Updated 13 Dec 2024

Popular Companies

search-icon

Q1. 1)Diffrence Between sanity and Smoke 2)What is regression Testing 3)how many test cases you execute per day 4)Tell me the diffrent Types of waits 5)When we use Implicite and Explicite wait 6)How many times you ...

read more
Ans.

Answers to common questions asked in an Automation Tester interview

  • Sanity testing is a subset of regression testing and is done to check if the critical functionalities of the application are working fine after a small change

  • Smoke testing is done to check if the application is stable enough for further testing

  • Regression testing is done to ensure that the changes made to the application do not affect the existing functionalities

  • The number of test cases executed per day depends...read more

Q2. How to mouse hover an element? Write Xpath for an element? How to run test parallel? Explain automation test framework that you worked in? What is data provider in testng? What is collections in Java? About lis...

read more
Ans.

Answers to common questions asked in an Automation Tester interview.

  • To mouse hover an element, you can use Actions class in Selenium WebDriver.

  • Xpath for an element can be written using various attributes like id, class, etc.

  • To run tests parallel in TestNG, you can use 'parallel' attribute in testng.xml file.

  • Automation test framework I worked in was based on Page Object Model design pattern.

  • Data provider in TestNG is used to provide data for test methods.

  • Collections in Java ar...read more

Automation Tester Interview Questions and Answers for Freshers

illustration image

Q3. There is a table of students having column status with either pass or fail. Write the syntax to show the output as some 60 pass and 40 fail.

Ans.

Use SQL query to display 60 pass and 40 fail from a table of students.

  • Use SELECT statement with COUNT function to count the number of pass and fail statuses.

  • Use WHERE clause to filter out pass and fail statuses.

  • Use GROUP BY clause to group the statuses together.

  • Use CASE statement to display the count of pass and fail statuses.

Q4. How to validate that the URL loaded is correct or not?

Ans.

To validate the correct URL loaded, check the current URL in the browser.

  • Get the current URL from the browser using driver.getCurrentUrl() method in Selenium.

  • Compare the current URL with the expected URL to validate correctness.

  • Use assertions or conditional statements to confirm if the URL is correct.

  • Consider handling any redirects or dynamic URLs that may affect validation.

  • Utilize regular expressions for more flexible URL validation.

Are these interview questions helpful?

Q5. write the dynamic Xpath for the Date element in the cleartrip website

Ans.

Dynamic Xpath for Date element in cleartrip website

  • Use contains() function to match partial attribute value

  • Use @class attribute to uniquely identify the Date element

  • Combine multiple attributes to create a dynamic Xpath

Q6. What asserts do you use, hard assert and soft assert

Ans.

Both hard assert and soft assert are used depending on the scenario.

  • Hard assert stops the execution immediately if the assertion fails.

  • Soft assert continues the execution even if the assertion fails and logs the failure.

  • Hard assert is used when the failure of the assertion means the test case cannot continue.

  • Soft assert is used when the failure of the assertion does not mean the test case cannot continue.

  • Both asserts are important and should be used appropriately based on the...read more

Share interview questions and help millions of jobseekers ๐ŸŒŸ

man-with-laptop

Q7. write a python code for separating numbers, special characters from a string

Ans.

Python code to separate numbers and special characters from a string into an array of strings.

  • Use regular expressions to match numbers and special characters in the string.

  • Split the string based on the matched patterns to separate numbers and special characters.

  • Store the separated numbers and special characters in an array of strings.

Q8. 1)Explain Access Specifiers 2)Tell me the functional flow of your application On which you are working as a User

Ans.

Access Specifiers and Functional Flow of Application

  • Access Specifiers define the scope of a class member

  • Public members can be accessed from anywhere

  • Private members can only be accessed within the class

  • Protected members can be accessed within the class and its subclasses

  • Functional flow of the application describes the sequence of actions performed by the user

  • It includes login, navigation, data entry, submission, and logout

  • For example, in an e-commerce website, the flow would b...read more

Automation Tester Jobs

Automation Tester โ€ข 6-8 years
CGI Information Systems and Management Consultants
โ€ข
4.0
Bangalore / Bengaluru
RDK Automation Tester โ€ข 3-8 years
Cognizant
โ€ข
3.8
Noida
Automation Tester-Python-N โ€ข 4-9 years
Infosys
โ€ข
3.7
Hyderabad / Secunderabad

Q9. There are n no. Of links having the text selenium. Write the syntax to count the text selenium from all the links

Ans.

Use XPath to count the number of links with the text 'selenium'

  • Use XPath to locate all the links containing the text 'selenium'

  • Count the number of links found using the XPath expression

Q10. 1) What is system testing. 2) What is sanity testing. 3) What is performance testing. 8) What is bus and error.

Ans.

Answers to common questions asked in an Automation Tester interview.

  • System testing is a type of testing that verifies the behavior of a complete and fully integrated software system.

  • Sanity testing is a type of testing that is performed to ensure that the critical functionalities of the application are working fine.

  • Performance testing is a type of testing that is performed to determine how a system performs in terms of responsiveness and stability under a particular workload.

  • B...read more

Q11. What are the various annotations in selenium webdriver

Ans.

Annotations in Selenium WebDriver are used to provide additional information about the test methods.

  • Annotations help in organizing and managing test cases

  • Some common annotations in Selenium WebDriver are @Test, @BeforeTest, @AfterTest, @BeforeClass, @AfterClass, @BeforeMethod, @AfterMethod

  • Annotations are used to define the sequence of execution of test methods

Q12. How to run parallel mode in testng,groups,priority

Ans.

TestNG allows running tests in parallel mode using groups and priorities.

  • Use 'parallel' attribute in testng.xml file to specify parallel mode (e.g. )

  • Use 'groups' attribute in testng.xml file to group tests that should run in parallel (e.g. )

  • Use 'priority' attribute in testng.xml file to specify the order in which tests should run (e.g. )

Q13. Where have you applied oops in automation framework

Ans.

I have applied OOPs concepts in automation framework by creating classes for different components, inheritance for reusability, and encapsulation for data protection.

  • Used classes to represent different components of the automation framework

  • Implemented inheritance for reusability of code

  • Utilized encapsulation to protect data within the classes

  • Applied polymorphism to allow objects to be treated as instances of their parent class

Q14. How to read and validate data from PDF file?

Ans.

To read and validate data from a PDF file, use a PDF parsing library to extract text and then validate the extracted data.

  • Use a PDF parsing library like Apache PDFBox or iText to extract text from the PDF file

  • Validate the extracted data by comparing it with expected values or patterns

  • Consider using regular expressions for data validation

  • Handle different types of data formats within the PDF file, such as text, tables, or images

Q15. Write syntax of data driven testing (XSSF Workbook) Syntax

Ans.

Data driven testing syntax using XSSF Workbook

  • Create XSSFWorkbook object

  • Get the sheet from the workbook

  • Iterate through rows and columns to fetch test data

  • Use test data in your test cases

Q16. Print the duplicates in a string with its count

Ans.

Print duplicates in a string with their count

  • Convert string to char array

  • Use HashMap to store character count

  • Iterate through HashMap to print duplicates

Q17. Where multiple inheritance used in automation framework

Ans.

Multiple inheritance is used in automation frameworks to inherit properties and methods from multiple parent classes.

  • Multiple inheritance allows a class to inherit from more than one parent class.

  • It helps in reusing code and promoting code organization.

  • Example: A test case class can inherit from a base test class and a utility class to access test methods and utility functions.

Q18. Explain what is Background keyword in BDD

Ans.

Background keyword in BDD is used to define common steps that are executed before each scenario in a feature file.

  • Background keyword is used to reduce duplication of common steps in scenarios.

  • It is placed at the beginning of a feature file before scenarios.

  • All steps defined under Background keyword are executed before each scenario in the feature file.

  • It helps in maintaining consistency and readability of feature files.

  • Example: If all scenarios in a feature file require loggi...read more

Q19. How to read data from an XL file using selenium

Ans.

You can read data from an Excel file using Apache POI library in Selenium.

  • Use Apache POI library to interact with Excel files

  • Create a FileInputStream object to read the Excel file

  • Create a Workbook object to represent the Excel file

  • Get the desired sheet from the Workbook

  • Iterate through rows and cells to read data

Q20. program to find common elements from an array and store in list

Ans.

Program to find common elements from an array of strings and store in a list

  • Iterate through each element in the array

  • Use a HashMap to store the frequency of each element

  • Add elements with frequency greater than 1 to the list

Q21. What are the different gherkin words

Ans.

Gherkin words are keywords used in Gherkin syntax for writing test scenarios in Behavior Driven Development (BDD).

  • Feature

  • Scenario

  • Given

  • When

  • Then

  • And

  • But

Q22. What is sanity testing. What is black box testing. What is selenium.

Ans.

Sanity testing is a subset of regression testing. Black box testing is a testing technique that focuses on the functionality of the software. Selenium is a popular open-source automation tool for web applications.

  • Sanity testing is a quick test to ensure that the critical functionalities of the application are working fine after a minor change.

  • Black box testing is a testing technique that focuses on the functionality of the software without looking at its internal structure.

  • Se...read more

Q23. How to give you quality product to the client?

Ans.

To deliver a quality product to the client, thorough testing, continuous communication, and adherence to requirements are essential.

  • Conduct thorough testing at every stage of development to catch bugs early on

  • Communicate regularly with the client to ensure their needs and expectations are being met

  • Follow the requirements and specifications provided by the client to deliver a product that meets their criteria

Q24. Difference between Arraylist vs linked list interface vs abstract locators

Ans.

Arraylist vs linked list, interface vs abstract, locators

  • ArrayList and LinkedList are both used to store collections of data, but ArrayList is faster for accessing elements while LinkedList is faster for adding or removing elements.

  • Interfaces are used to define a contract for a class to implement, while abstract classes can provide some implementation and cannot be instantiated.

  • Locators are used in test automation to identify web elements on a page, such as ID, name, class, o...read more

Q25. 3. String str= abaaac find occurrence of consecutive chars

Ans.

Count the occurrences of consecutive characters in a given string.

  • Iterate through the string and compare each character with the next one

  • Keep track of the count when consecutive characters are found

  • Store the consecutive characters and their counts in an array of strings

Q26. Explain Framework details and day to day tasks

Ans.

A framework is a set of guidelines and standards for creating and maintaining automation scripts. Day to day tasks include script creation, execution, and maintenance.

  • Designing and implementing automation scripts

  • Executing automated tests and analyzing results

  • Maintaining and updating existing scripts

  • Collaborating with developers and other team members

  • Reporting and tracking defects

  • Continuous improvement of the automation framework

Q27. What is config file in playwright

Ans.

Config file in Playwright is used to store settings and configurations for the automation tests.

  • Config file is typically a JSON or JavaScript file where you can define settings such as browser type, launch options, timeouts, etc.

  • It helps in centralizing and managing configurations for multiple tests.

  • Example: playwright.config.js file in Playwright project.

Q28. What is playwright and itโ€™s features

Ans.

Playwright is a Node.js library for browser automation that allows you to write reliable and maintainable tests.

  • Playwright supports multiple browsers such as Chrome, Firefox, and WebKit.

  • It provides a single API to automate web applications across different browsers.

  • Playwright has built-in support for headless mode, network interception, and device emulation.

  • It allows you to take screenshots, record videos, and trace network activity during test execution.

Q29. Program to write highest number of array?

Ans.

Program to find the highest number in an array of strings.

  • Convert each string element in the array to an integer

  • Iterate through the array to find the highest number

  • Return the highest number found

Q30. What we will use in plugin

Ans.

Plugins are used to extend the functionality of a software application.

  • Plugins are additional software components that can be added to an existing application to provide new features or functionalities.

  • They can be used to customize the behavior of the application without modifying its core code.

  • Examples of plugins include browser extensions, WordPress plugins, and Adobe Photoshop filters.

Q31. What is the use of dependent methods?

Ans.

Dependent methods are used to execute test cases in a specific order to avoid failures.

  • Dependent methods ensure that the test cases are executed in a specific order.

  • They help in avoiding failures due to dependencies between test cases.

  • If a test case is dependent on the output of another test case, dependent methods ensure that the first test case is executed before the second.

  • They are useful in automated testing where multiple test cases need to be executed in a specific orde...read more

Q32. Write a code snippet of opening link using webdriver

Ans.

Code snippet to open a link using WebDriver

  • Instantiate a WebDriver object

  • Use the get() method to open the desired URL

Q33. How to handle dynamic table element

Ans.

Dynamic table elements can be handled by locating the table, identifying the rows and columns, and using appropriate methods to interact with the data.

  • Locate the table element using a unique identifier such as class, id, or xpath

  • Identify the rows and columns within the table using HTML tags like and

  • Use methods like getText() or getAttribute() to retrieve data from the table cells

  • Handle dynamic changes in the table by using dynamic xpath or waiting for specific elements to lo...read more

Q34. Why does def keyword used in selenium

Ans.

The def keyword is used in Selenium to define a function or method.

  • Used to define reusable code blocks

  • Helps in organizing code and improving readability

  • Allows for easier maintenance and updates

  • Example: def login(username, password) { //code to login }

Q35. Difference between black box and white box testing

Ans.

Black box testing focuses on functionality without knowledge of internal code, while white box testing examines internal code structure.

  • Black box testing tests the functionality of a system without knowledge of its internal code

  • White box testing tests the internal code structure and logic of a system

  • Black box testing is more focused on end-user perspective

  • White box testing is more focused on developer perspective

  • Example: Testing a website's login functionality without knowing...read more

Q36. Difference between hard assert and soft assert

Ans.

Hard assert stops the execution of the test case if it fails, while soft assert continues the execution and logs the failure.

  • Hard assert is used when the failure of a particular step makes the further steps irrelevant.

  • Soft assert is used when you want to continue with the test case execution even if some steps fail.

  • Hard assert is implemented using 'assert' keyword in testing frameworks like TestNG or JUnit.

  • Soft assert is implemented using libraries like AssertJ or TestNG's So...read more

Q37. Explain The Framework work use in Project

Ans.

The framework used in the project is a combination of data-driven and keyword-driven frameworks.

  • The framework allows for easy maintenance and scalability of test cases.

  • It separates test data from test scripts, making it easier to update test data without changing the scripts.

  • Reusable functions and libraries are used to reduce redundancy in test scripts.

  • Test cases are written in a modular fashion, allowing for easy debugging and troubleshooting.

  • Automation tools like Selenium a...read more

Q38. How to run runner class

Ans.

To run a runner class, you can use a test runner tool like JUnit or TestNG in your automation testing framework.

  • Use a test runner tool like JUnit or TestNG to execute the runner class

  • Add the @RunWith annotation in JUnit or specify the runner class in TestNG XML file

  • Make sure the runner class includes the necessary setup and teardown methods for test execution

Q39. java code to identify duplicates in given string

Ans.

Java code to identify duplicates in a given string

  • Convert the string into an array of characters

  • Use a HashMap to store each character and its frequency

  • Iterate through the array and check if the character already exists in the HashMap

  • If it does, increment the frequency count, if not, add it to the HashMap

  • Finally, iterate through the HashMap and print out the characters with frequency greater than 1

Q40. reverse this word "I love automation" using java

Ans.

Reverse the word 'I love automation' using Java

  • Create a StringBuilder object and pass the word to be reversed as a parameter

  • Use the reverse() method of the StringBuilder class to reverse the word

  • Convert the reversed word back to a string using the toString() method

Q41. difference between regression and re-testing.

Ans.

Regression testing is testing the entire application after a change, while re-testing is testing a specific part after a bug fix.

  • Regression testing involves testing the entire application to ensure that new changes have not affected existing functionality.

  • Re-testing involves testing a specific part of the application that was previously found to have a bug, after the bug has been fixed.

  • Regression testing is done to ensure that new changes do not introduce new bugs, while re-t...read more

Q42. how to download PDF file?

Ans.

To download a PDF file, you can use a web browser or a command line tool like wget or curl.

  • Use a web browser to navigate to the webpage containing the PDF file link

  • Right-click on the link to the PDF file and select 'Save link as' or 'Download linked file'

  • Alternatively, you can use command line tools like wget or curl to download the PDF file

Q43. Write Reverse a string programme

Ans.

Program to reverse a string using array of characters

  • Create an array of characters from the input string

  • Iterate through the array in reverse order and append each character to a new string

  • Return the reversed string

Q44. What does it mean CI/CD ?

Ans.

CI/CD stands for Continuous Integration/Continuous Deployment. It is a software development practice that enables frequent and automated code integration, testing, and deployment.

  • CI/CD is a set of practices and tools that aim to automate the software development process.

  • Continuous Integration involves regularly merging code changes into a shared repository and running automated tests to detect integration issues.

  • Continuous Deployment focuses on automating the release and depl...read more

Q45. Write java program to Reverse the String

Ans.

Java program to reverse a string

  • Create a char array from the input string

  • Use two pointers to swap characters from start and end of the array

  • Convert the char array back to a string and return

Q46. How to perform Mouse actions

Ans.

Mouse actions can be performed using Selenium WebDriver by using Actions class

  • Create an instance of Actions class

  • Use methods like moveToElement, click, doubleClick, contextClick, dragAndDrop, etc.

  • Perform the desired action by calling the respective method on the Actions object

Q47. Difference Between find elements and element

Ans.

find elements is used to locate multiple elements on a web page, while element is used to locate a single element.

  • find elements returns a list of elements matching the locator, while element returns the first element found

  • find elements is useful when there are multiple elements with the same locator, while element is used when only one element is expected

  • find elements can be used with methods like findElements() in Selenium, while element is used with methods like findElement...read more

Q48. What is Desired Capabilities

Ans.

Desired Capabilities are a set of key-value pairs used to configure the WebDriver browser during test automation.

  • Used to set properties for WebDriver browser

  • Can be used to configure browser settings like browser name, version, platform, etc.

  • Helps in customizing the behavior of the browser during automation tests

Q49. 2. Second Largest Element from an array.

Ans.

Find the second largest element in an array of strings.

  • Convert the strings to integers for comparison.

  • Sort the array in descending order.

  • Return the second element in the sorted array.

Q50. How to do parallel execution

Ans.

Parallel execution can be achieved by running multiple test cases simultaneously to save time and increase efficiency.

  • Use test automation frameworks like TestNG or JUnit to run tests in parallel

  • Configure test suites to run in parallel using tools like Selenium Grid

  • Leverage cloud-based testing platforms for parallel execution

  • Use tools like Jenkins to schedule and execute tests in parallel

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.9
ย โ€ขย 7.8k Interviews
3.7
ย โ€ขย 7.3k Interviews
3.8
ย โ€ขย 5.4k Interviews
3.7
ย โ€ขย 5.2k Interviews
3.8
ย โ€ขย 4.6k Interviews
3.6
ย โ€ขย 2.3k Interviews
4.1
ย โ€ขย 2.3k Interviews
4.0
ย โ€ขย 124 Interviews
3.1
ย โ€ขย 52 Interviews
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

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