MockMate

Interview questions · Company interviews

Infosys Automation Testing Interview Questions 2026: Selenium, Java, TestNG and API Testing (30 Q&A)

How Infosys hires automation testers in 2026, what the technical rounds cover, and 30 Selenium, Java, TestNG, API testing and SQL questions with answers.

Updated 13 min read

Infosys hires automation testers continuously, on campus through the system engineer route and off campus through lateral drives for Selenium and Java profiles. The interview is practical: interviewers make you write an XPath, explain how you would handle a dynamic element, and sometimes code a login-page test on the spot. This page covers how the process runs in 2026, what the panels test, and 30 questions across Selenium, Java, TestNG, API testing, SQL and framework design, with sample answers for freshers and candidates up to about five years.

If you are a fresher who was placed into testing through the system engineer route, the questions in the first three groups are your priority. If you are a lateral with two to five years, the framework and API groups are where the offer is decided.

How the Infosys automation testing process works in 2026

As of September 2026, candidate reports on Glassdoor and Naukri Code360 describe a three-round process for automation roles.

Round 1: technical, usually virtual. Selenium fundamentals, Java and OOP concepts, and one or two coding questions. Reported examples include writing code for a Facebook-style login scenario and explaining a diamond-pattern program. Thirty to forty-five minutes.

Round 2: technical, in person or on video. Deeper: live coding, writing XPath for elements the interviewer describes, API testing questions, and framework discussion for experienced candidates. Forty-five to sixty minutes. Some drives combine rounds 1 and 2 into one longer session.

Round 3: HR. Salary expectations, notice period, location, shift flexibility and reasons for switching. Fifteen to twenty minutes.

Fresher route. Campus and off-campus freshers usually come through Infosys's online assessment (aptitude, reasoning, verbal and pseudocode) followed by a technical-plus-HR interview; allocation to testing happens after training. The questions below still apply, but the fresher interview is broader and lighter.

Compensation. Infosys does not publish role-wise CTC on its careers site. Do not rely on numbers from forums; ask the recruiter for the band and confirm the fixed versus variable split in writing before resigning from your current job.

What the Infosys automation interviewer is testing

  • Can you locate elements reliably. XPath and CSS written live, including dynamic IDs and relative locators.
  • Do you understand synchronisation. Implicit, explicit and fluent waits, and why Thread.sleep is a smell.
  • Java depth appropriate to your years. OOP for freshers; collections, exceptions, generics and design patterns for laterals.
  • Framework thinking. Page Object Model, data-driven and hybrid frameworks, TestNG structure, reporting, and integration with Jenkins or GitHub Actions.
  • API testing. HTTP basics, Rest Assured or Postman, validation, chaining and authentication.
  • Judgement. What to automate, what not to, and how you handle flaky tests and failures in a client delivery.

30 Infosys automation testing interview questions with sample answers

Selenium fundamentals

1. What is the difference between findElement and findElements?

"findElement returns the first matching WebElement and throws NoSuchElementException if nothing matches. findElements returns a List<WebElement>, empty if nothing matches, and never throws. I use findElements when I need to check presence without an exception, for example driver.findElements(By.id("error")).isEmpty() to assert no error banner appeared."

2. Explain the types of waits in Selenium and when you use each.

"Implicit wait sets a global timeout for element lookup; it is simple but applies everywhere and can mask problems. Explicit wait, WebDriverWait with ExpectedConditions, waits for a specific condition such as elementToBeClickable, and is what I use for almost everything. Fluent wait adds polling interval and ignored exceptions for unusual cases. I never mix implicit and explicit waits, because the timeouts interact unpredictably, and I avoid Thread.sleep except for debugging."

3. Write an XPath for a 'Submit' button whose ID changes on every page load.

"I would not use the ID. Options: //button[text()='Submit'], or if the text has whitespace, //button[normalize-space()='Submit']. If there are several Submit buttons, anchor on a stable ancestor: //form[@name='login']//button[normalize-space()='Submit']. If part of the ID is stable, //button[starts-with(@id,'submit_')] or contains(@id,'submit'). I prefer relative XPath with a stable attribute over absolute paths, which break on any layout change."

4. How do you handle a dropdown, and what if it is not a <select> element?

"For a real <select> I use the Select class: selectByVisibleText, selectByValue, selectByIndex. Many modern UIs use a div-based dropdown; then I click the trigger, wait for the options list to be visible, and click the option located by text. I wrap that in a page-object method so the test reads homePage.selectCity("Pune") regardless of the implementation."

5. How do you switch to a frame, a new window, and an alert?

"driver.switchTo().frame(...) by index, name or WebElement, and defaultContent() to come back. For windows, capture getWindowHandle() before the action, then iterate getWindowHandles() and switch to the one that is not the parent; Selenium 4 also has newWindow. For JavaScript alerts, switchTo().alert() then accept(), dismiss() or sendKeys(). The common bug is forgetting to switch back."

6. What is StaleElementReferenceException and how do you fix it?

"The element reference I hold points to a DOM node that has been replaced, usually after a page refresh, an AJAX re-render or navigation. Fix: re-locate the element right before using it rather than storing it in a field, or use an explicit wait with refreshed(ExpectedConditions...). In page objects I return locators or use @FindBy with PageFactory, which re-locates on each access."

7. How do you take a screenshot on failure?

"In a TestNG listener's onTestFailure, cast the driver to TakesScreenshot, call getScreenshotAs(OutputType.FILE), and save it with the test name and timestamp, then attach it to the Extent or Allure report. Doing it in the listener keeps the tests clean."

8. How would you automate a file upload and a file download?

"Upload: if the input is <input type='file'>, sendKeys with the absolute file path works without any dialog. If it is a custom button that opens the OS dialog, I would use Robot class or AutoIT as a last resort. Download: configure the browser profile to save to a known directory without prompting, trigger the download, then poll the directory for the file with a timeout."

Java for automation

9. Explain the four OOP pillars using your framework as the example.

"Encapsulation: page classes keep locators private and expose actions. Abstraction: BasePage exposes click and type with waits inside, so tests never see WebDriverWait. Inheritance: every page extends BasePage, every test extends BaseTest for setup and teardown. Polymorphism: a DriverFactory returns WebDriver, and the actual instance is Chrome, Edge or a remote driver depending on config."

10. Write a program to reverse a string and count the vowels in it.

Say the approach first. "For reverse, iterate from the last index to zero appending to a StringBuilder, or use new StringBuilder(s).reverse() if allowed. For vowels, loop through characters, lower-case each, and increment a counter when it is in aeiou. Both O(n)." Then write it. Interviewers watch whether you handle null and empty strings.

11. ArrayList versus HashMap versus HashSet. Where have you used each?

"ArrayList for ordered data with duplicates, such as a list of rows read from a table. HashSet for uniqueness checks, such as verifying no duplicate values in a dropdown. HashMap for key-value lookups, such as test data keyed by scenario name. HashMap allows one null key; Hashtable does not and is synchronised."

12. What is the difference between checked and unchecked exceptions, and how do you handle exceptions in a framework?

"Checked exceptions must be handled or declared; IOException when reading a properties file. Unchecked ones extend RuntimeException; NoSuchElementException from Selenium is unchecked. In the framework I catch specific exceptions in utility methods, log them with context, take a screenshot, and rethrow as a custom exception so the test fails with a clear message rather than being swallowed."

13. What is a static keyword, and why should the WebDriver not be static in a parallel run?

"Static members belong to the class, shared across instances and threads. A static WebDriver in parallel execution means every thread drives the same browser, causing chaos. I use ThreadLocal<WebDriver> in the driver manager so each thread has its own instance, and I clean it up in @AfterMethod."

14. Print this pattern: a diamond of stars for n = 5. (a reported Infosys question)

"Two loops: the upper half prints rows 1 to n with n - i spaces then 2i - 1 stars; the lower half prints rows n - 1 down to 1 the same way. I would write it, run it mentally for n = 3 to check the spacing, and mention the complexity is O(n²) in output size." Do not panic at pattern questions; they test whether you can reason about loops calmly.

TestNG and framework design

15. Explain the TestNG annotation order.

"@BeforeSuite, @BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass, @AfterTest, @AfterSuite. I launch the browser in @BeforeMethod and quit in @AfterMethod so every test starts clean. @BeforeSuite loads config and sets up the report."

16. How do you run tests in parallel and share data between them?

"In testng.xml set parallel='methods' or 'classes' with thread-count. Each thread gets its own driver through ThreadLocal. Tests should not share mutable data; if they must, I pass values through ITestContext attributes or, better, make each test set up its own preconditions through the API."

17. What is the Page Object Model, and what goes wrong when people implement it badly?

"Each page or component is a class holding locators and actions; tests call actions and assert outcomes. Bad implementations put assertions inside page classes, return void from navigation actions instead of the next page object, or make one giant page class for the whole application. I keep page methods returning the resulting page, keep assertions in tests, and split large pages into components like HeaderComponent."

18. Data-driven versus keyword-driven versus hybrid framework.

"Data-driven: same test logic, many data rows from Excel, CSV or a @DataProvider. Keyword-driven: test steps written as keywords in a sheet and an engine executes them, useful when non-programmers write tests, painful to maintain. Hybrid combines both. In practice I build a POM-based hybrid with @DataProvider for data and reusable utilities, and skip the keyword engine unless the client requires it."

19. How do you handle flaky tests?

"First find out why: timing, test-order dependency, shared test data, or a real intermittent bug. Fix waits, isolate data, and make tests independent. I use IRetryAnalyzer for one retry as a safety net, but I track which tests retried, because a retry that hides a real defect is worse than a red build. In a client project I reported flaky tests weekly with their root causes."

20. How is your framework integrated with CI?

"A Jenkins pipeline, or GitHub Actions, triggered on pull request and nightly. It runs mvn test with a testng.xml suite, publishes the Extent or Allure report as an artifact, and fails the build on any failure in the smoke suite. Nightly runs the full regression on a Selenium Grid or a cloud provider. Parameters like browser and environment come from Maven profiles."

21. What would you not automate?

"One-time tests, captcha and OTP flows without a test hook, visual look-and-feel judgements, and features that change every sprint. I would also not automate a flow until it is stable in manual testing. Automation ROI comes from regression, so I prioritise high-frequency, high-risk paths like login, checkout and search."

API testing

22. Difference between GET, POST, PUT, PATCH and DELETE, and which are idempotent?

"GET reads, POST creates, PUT replaces a resource fully, PATCH updates part of it, DELETE removes it. GET, PUT and DELETE are idempotent, so repeating them has the same effect; POST is not. That matters when I write retry logic in an API test."

23. How do you validate a JSON response in Rest Assured?

"given().header(...).when().get("/users/5").then().statusCode(200).body("name", equalTo("Asha")).body("roles.size()", greaterThan(0)). For complex responses I deserialise into a POJO with Jackson and assert on fields, or validate against a JSON schema with matchesJsonSchemaInClasspath. I also assert response time when the client has an SLA."

24. How do you chain requests, for example log in and then call a protected endpoint?

"Call the login endpoint, extract the token with extract().path("token") or a JsonPath expression, store it, and pass it as a Bearer header in subsequent requests. I keep the token in a test-context object rather than a static field so parallel runs do not share it."

25. What HTTP status codes should you know?

"200 OK, 201 Created, 204 No Content, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 422 validation error in many APIs, 500 Internal Server Error, 503 Service Unavailable. A negative test for a missing token should expect 401, not 403; the difference is a common interview follow-up."

26. How would you test an API without documentation?

"Capture traffic from the UI with browser dev tools or a proxy, list endpoints and payloads, confirm with the developers, and write a Postman collection first. Then automate the stable ones. I would flag the missing documentation as a risk in the test plan rather than silently guessing."

SQL and process

27. Write a query to find duplicate email addresses in a users table.

"SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1; For test validation I often follow with a join back to get the full rows. Automation testers at Infosys client projects check data through SQL constantly, so I keep joins, group by and subqueries sharp."

28. What is the difference between smoke, sanity and regression testing?

"Smoke: is the build stable enough to test at all, a few critical paths. Sanity: a narrow check that a specific fix or feature works. Regression: the full suite to confirm nothing else broke. My CI runs smoke on every PR and regression nightly."

29. Explain your current framework end to end in three minutes. (lateral candidates)

Structure: language and tools, folder structure, driver management, page objects, data handling, reporting, CI, and one improvement you made. Finish with numbers: number of tests, run time, and how much manual regression it replaced. Practise this aloud; it is the single most decisive answer in Infosys lateral testing interviews.

30. Why are you moving, and what is your notice period?

"My current project is manual-heavy and the automation work has dried up; I want a role where I own a framework. Notice period is 60 days, negotiable to 45 with leave adjustment, and buyout is allowed." Never criticise the current employer, and have the actual notice terms ready.

Mistakes that get automation candidates rejected at Infosys

  • Writing absolute XPath or copying from the browser's "Copy XPath" and calling it done.
  • Defending Thread.sleep. Interviewers use it as a filter for whether you understand synchronisation.
  • Claiming a framework you cannot draw. If you say "hybrid framework", be able to explain the folder structure and the flow of one test.
  • No API testing at all for a lateral profile. Most Infosys automation openings in 2026 expect it.
  • Skipping Java. "I only know Selenium" fails the first round; Selenium is a library, Java is the skill.
  • A vague notice period in HR. Managers plan project allocations around it.

How to practise the Infosys automation testing round

The two things that decide this interview, writing locators and code live and explaining your framework under follow-up questions, both improve fast with spoken practice and slowly with reading.

In MockMate Practice, attach your resume and paste the Infosys automation testing job description, choose a technical round and run an adaptive session in the browser. The code editor lets you write the Java program or the XPath while the interviewer persona asks about waits, exceptions and your framework, following up on what you actually said. The report afterwards shows every answer, your response timing, the coaching evidence and the weaknesses that repeat, with a recommended next practice. Eligible accounts get three free Practice starts of up to ten minutes each as of September 2026. Use MockMate Live assistance only in interviews or meetings where the organisation or interviewer permits it; for Infosys selection rounds, where it is not permitted, stay with Practice.

A five-day plan: day one, write ten XPaths for a real site and explain each aloud; day two, three Java programs (reverse, pattern, duplicates) spoken through before coding; day three, draw your framework on paper and record a three-minute explanation; day four, a Practice round, read the report; day five, fix the weakest two answers and run again. For the wider Infosys process see the Infosys hub, and for the manager conversation the Infosys managerial round page.

Frequently asked questions

How many rounds are there in the Infosys automation testing interview?

As of September 2026, candidates report three: a technical round on Selenium, Java and OOP, usually virtual; a second technical round with live coding, XPath writing and API testing questions; and an HR round covering salary, notice period and location. Some lateral drives merge the two technical rounds.

Is Java mandatory for Infosys automation testing roles?

Most Infosys automation openings ask for Selenium with Java and TestNG, because that is what their client frameworks use. Python with Selenium or pytest is accepted in some accounts, but expect Java questions on collections, OOP and exceptions in the interview.

Does Infosys ask coding questions in automation testing interviews?

Yes. Expect one or two short Java programs such as reversing a string, counting characters or a pattern-printing problem, plus writing an XPath live and sometimes a small Selenium script for a login page.

What API testing questions does Infosys ask?

The difference between GET, POST and PUT, HTTP status codes, how to validate a JSON response, how to chain requests using a token from a previous response, and how you would automate an API test in Rest Assured or Postman.

What experience level do these questions target?

The page covers 0 to about 5 years. Freshers get the fundamentals and one coding question; laterals get framework design, flaky-test handling, CI integration and API automation in depth.

Practice an Infosys automation testing round with MockMate

Three free Practice starts and three free Live starts of up to ten minutes each, no card needed. Use Live only where assistance is permitted.

Start free

Sources

  1. Infosys Test Automation Engineer interview questions and experiences (Glassdoor)
  2. Top 40 Infosys automation testing interview questions and answers (Internshala)
  3. Infosys interview questions for automation testing, Selenium + Java (Medium, Arpit Choubey)
  4. Infosys interview experience, July 2025, 0 to 2 years (Naukri Code360)
  5. Infosys careers (official)

Keep reading