QA Automation Tester Interview Questions and Answers
QA Automation Tester Interview Questions and Answers
Selenium WebDriver
Q: What are different types of locators in Selenium?
A: ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, CSS Selector, XPath.
Q: What should be the ideal way to store data using Selenium WebDriver only?
A: Use data structures like HashMaps in the test code or external files (e.g., Excel, JSON).
Q: Is it possible to use Xpath like parent/child/node/.. ? If yes, provide an example where to use it?
A: Yes. Example: `//div[@id='parent']/child::span` or `..` to move up a node.
Q: What happens if you receive browser notifications during test automation execution?
A: They can interfere. Handle them using browser profile settings to disable.
Q: Why does Stale Element Exception occur, and how to handle it?
A: Occurs when the DOM changes. Use try-catch and re-locate the element.
APIs
Q: What are the components of an HTTP request?
A: Method, URL, Headers, Body.
Postman
Q: When to use collections, environments, and global variables?
A: Collections group requests. Environments store variables. Globals are available across
collections.
Q: How to validate that an API response has the correct status code?
A: In 'Tests' tab: `pm.response.to.have.status(200)`
Q: What happens when an API response returns Form Data instead of JSON, and how to validate
it?
A: Parse it manually or use text checks if JSON is not returned.
Q: How will you validate an API request if VPN is required for it to work?
A: Ensure VPN is active before sending the request.
Git
Q: What are the different stages in committing the code to GitHub?
A: Working Directory -> Staging Area -> Local Repository -> Remote Repository.
Q: When do you commit your code? After committing, how do you validate that everyone has the
updated code?
A: Commit after testing. Use `git pull` and `git status` to sync.
TestNG
Q: What is the execution format of tests in TestNG?
A: Alphabetically or by priority/annotations in XML/test class.
Q: Can priority be negative for methods? If yes, what is the execution flow as per priority?
A: Yes. Lower (even negative) priority runs first.