These Cognizant QA interview questions follow the three rounds candidates commonly report: a technical round on Agile, Git, Selenium, Java and API testing; a coding and practical round with live Selenium tasks; and an HR round. Answers are concise and current for 2026. For the older combined set, see Cognizant and Infosys interview questions.
Round 1: Technical
1. Tell me about yourself and your roles and responsibilities.
A one-minute summary: experience, core skills (Selenium with Java, TestNG, API testing, SQL), your current project and responsibilities, and one achievement. Prepare a 30-second version in case you're interrupted.
2. Describe the Agile process and your daily work in it.
Two-week sprints: in planning we estimate and commit to stories; in refinement QA clarifies acceptance criteria; daily stand-ups cover progress and blockers. During the sprint I design and execute tests as stories are ready, automate stable scenarios, log and retest defects, and run regression before the sprint review; in the retrospective we improve the process.
3. How do you push and pull code with Git?
git pull origin develop # get the latest changes first
git checkout -b feature/login-tests
git add .
git commit -m "Add login negative tests"
git push -u origin feature/login-tests # then raise a pull request
4. Your script sometimes works and sometimes gets stuck. Why, and how do you fix it?
Usually synchronisation: the script acts before the element is ready, an overlay or spinner blocks it, the page re-renders (stale elements), or tests share data or a driver when run in parallel. Replace fixed sleeps with explicit waits on the right condition, wait for loaders to disappear, re-find elements after updates, isolate test data and use one driver per thread. See flaky test scenarios.
5. Absolute vs relative XPath: which is better?
Relative XPath (//button[@id='login']) is better: it anchors on meaningful attributes and survives layout changes. Absolute XPath (/html/body/div[2]/…) breaks whenever the structure changes.
6. Two login buttons have identical properties, one in the header and one in the footer. How do you locate the second?
Scope it by its container rather than relying on an index: //footer//button[normalize-space()='Login']. If there's no distinguishing container, use the index on the whole result set: (//button[normalize-space()='Login'])[2], with the parentheses, which is different from //button[2].
7. Method overloading vs overriding?
Overloading: same method name, different parameter lists, in the same class, resolved at compile time (for example several click() helpers taking a By or a WebElement). Overriding: a subclass provides its own implementation of a parent method with the same signature, resolved at run time (for example each browser's driver implementing get()).
8. When do you use implicit wait and when explicit wait?
Use explicit waits for specific conditions on specific elements (visible, clickable, text present). Avoid implicit waits in frameworks, or keep them at zero, because mixing them with explicit waits causes unpredictable delays.
9. How do you change JSON request data and add authentication to an API request?
String body = Files.readString(Path.of("src/test/resources/payloads/user.json"));
JSONObject json = new JSONObject(body);
json.put("email", "asha+" + System.currentTimeMillis() + "@example.com"); // change a field
given().auth().oauth2(token) // add authentication
.contentType(ContentType.JSON).body(json.toString())
.when().post("/users")
.then().statusCode(201);
Round 2: Coding and Practical
10. Explain your project and the flow of your framework.
Walk through a test run: Maven starts TestNG with the suite file; a base class reads configuration and creates the driver through a factory; tests call page objects; data comes from a provider; listeners capture screenshots and write the report; Jenkins publishes results and notifies the team.
11. Automate a calendar web element.
Prefer typing into the input if it accepts text. For a custom widget, open it, move to the target month by comparing the header text in a bounded loop, and click the day by its visible text. See the calendar answer in TCS QA interview questions.
12. A web table has 3 columns and 4 rows. Sort by the second column and get the fourth row's value.
driver.findElement(By.xpath("//table[@id='data']//th[2]")).click(); // sort by column 2
new WebDriverWait(driver, Duration.ofSeconds(5)).until(d -> isSorted(d)); // wait for the re-render
String value = driver.findElement(By.xpath("//table[@id='data']//tbody/tr[4]/td[2]")).getText();
// Or verify the sort yourself:
List<String> col = driver.findElements(By.xpath("//table[@id='data']//tbody/tr/td[2]"))
.stream().map(WebElement::getText).toList();
assertEquals(col, col.stream().sorted().toList());
13. Explain the Page Object Model.
Each page or component is a class that holds its locators privately and exposes user actions as methods (loginAs, searchFor), returning the next page object. Tests read like user journeys, and a UI change is fixed in one class.
14. How do you take screenshots for failed tests?
In an ITestListener.onTestFailure method, cast the current thread's driver to TakesScreenshot, save the file with the test name and timestamp, and attach it to Extent or Allure.
Round 3: HR
15. Why are you looking for a new job?
Growth-focused and positive: more automation and framework responsibility, new domains, larger-scale systems.
16. What are your strengths and weaknesses?
Pick strengths relevant to testing with an example (attention to detail, automation design). For a weakness, choose a real but non-critical one and what you're doing about it, for example improving at estimating effort by tracking actuals each sprint.
17. Why do you want to join Cognizant?
Mention the variety of client projects and domains, the scale of delivery and learning opportunities, tied to your career goals.
18. Where do you see yourself in five years?
Growing from automation engineer to an SDET or QA lead role: owning frameworks, mentoring testers and shaping test strategy.
For situation questions such as a rejected bug or a bug you can't reproduce, see defect-handling scenario questions.
FAQs
How many rounds are in a Cognizant QA interview?
Candidates commonly report a technical round, a coding or practical round and an HR round; some teams combine the first two.