Skip to content

Visa Automation Testing Interview Questions & Answers

Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.

Solved for VisaStart practicing
3 QUESTIONS FREESign up or log in to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

How do you scroll a page in Selenium?

VisaMedium
Save to ▾
Show answer
Use JavascriptExecutor with window.scrollTo or scrollIntoView, or the Actions class scroll methods in Selenium 4.
02

What is contract testing?

VisaMedium
Save to ▾
Show answer
Verifying that a provider and consumer agree on request and response formats, using tools like Pact, to catch breaking changes early.
03

What are the Actions class use cases?

VisaMedium
Save to ▾
Show answer
Mouse and keyboard actions such as hover, drag and drop, double click, right click and key combinations, built with moveToElement(...).perform().
04

How do you run JavaScript in Selenium?

VisaMedium
Save to ▾
Show answer
Cast the driver to JavascriptExecutor and use executeScript, for example to scroll into view or click hidden elements.
05

Where do you use OOP concepts in your framework?

VisaMedium
Save to ▾
Show answer
Encapsulation: private locators with public page methods. Inheritance: pages extend a BasePage. Polymorphism: the WebDriver interface for different browsers. Abstraction: utility layers hiding Selenium details.
06

Write a GET test in REST Assured.

VisaMedium
Save to ▾
Show answer
given().baseUri(url) .when().get("/users/1") .then().statusCode(200).body("id", equalTo(1));
07

How do you make WebDriver thread-safe for parallel runs?

VisaMedium
Save to ▾
Show answer
Store each driver in a ThreadLocal so every thread gets its own instance and tests do not interfere.
08

Difference between absolute and relative XPath?

VisaMedium
Save to ▾
Show answer
Absolute starts from the root (/html/...) and breaks easily; relative starts anywhere with // and is more stable, for example //input[@id='email'].
09

Implicit vs explicit vs fluent wait?

VisaEasy
Save to ▾
Show answer
Implicit wait applies globally to element lookups. Explicit wait waits for a specific condition (WebDriverWait + ExpectedConditions). Fluent wait is an explicit wait with custom polling and ignored exceptions.
10

Difference between final, finally and finalize?

VisaEasy
Save to ▾
Show answer
final makes a variable, method or class unchangeable; finally is a block that always runs after try-catch; finalize is a deprecated method called before garbage collection.
11

What is Docker and how does it help tests?

VisaMedium
Save to ▾
Show answer
Docker packages tools in containers so tests run identically everywhere; Selenium Grid and browsers can be started quickly in containers.
12

What is the difference between hard and soft assertions?

VisaMedium
Save to ▾
Show answer
Hard assert stops the test at the first failure; SoftAssert collects failures and reports them together when assertAll() is called.
13

How do you integrate Selenium tests with Jenkins?

VisaMedium
Save to ▾
Show answer
Create a job or pipeline that checks out code, runs mvn test, publishes reports and triggers on commits or schedules.
14

How do you handle StaleElementReferenceException?

VisaMedium
Save to ▾
Show answer
Re-locate the element after the DOM refreshes, use explicit waits for the refreshed element, don't keep element references for long, or wrap the action in retry logic.
15

How do you switch between windows and tabs?

VisaMedium
Save to ▾
Show answer
Get getWindowHandles(), loop to find the target, and call driver.switchTo().window(handle); switch back using the stored parent handle.
16

What do HTTP status codes 200, 201, 400, 401, 403, 404 and 500 mean?

VisaEasy
Save to ▾
Show answer
200 OK, 201 Created, 400 bad request, 401 unauthenticated, 403 forbidden, 404 not found and 500 server error.
17

findElement vs findElements?

VisaEasy
Save to ▾
Show answer
findElement returns the first match and throws NoSuchElementException if nothing is found. findElements returns a List (empty if nothing is found) — handy to check whether an element exists.
18

How do you handle iframes?

VisaMedium
Save to ▾
Show answer
switchTo().frame(index, name or element) enters the frame, and switchTo().defaultContent() returns to the main page.
19

How do you handle a web table in Selenium?

VisaMedium
Save to ▾
Show answer
Locate rows and columns with XPath such as //table//tr and //td, loop through them to read or click cells, or build the XPath dynamically from the row text.
20

What is data-driven testing?

VisaMedium
Save to ▾
Show answer
Running the same test logic with multiple data sets from Excel, CSV, JSON or a database, so coverage increases without duplicating code.
21

What is the use of the this and super keywords?

VisaMedium
Save to ▾
Show answer
this refers to the current object; super refers to the parent class, used to call parent constructors and methods.
22

What is the difference between @BeforeTest and @BeforeMethod?

VisaMedium
Save to ▾
Show answer
@BeforeTest runs once before all methods in a test tag of testng.xml; @BeforeMethod runs before every test method.
23

What is the difference between == and equals() in Java?

VisaEasy
Save to ▾
Show answer
== compares references (or primitive values); equals() compares content when overridden, as in String.
24

What does dependsOnMethods do?

VisaMedium
Save to ▾
Show answer
It makes a test run only after specified tests pass, otherwise it is skipped. Use sparingly as it creates coupled tests.
25

What are Java collections and which ones do testers use most?

VisaMedium
Save to ▾
Show answer
ArrayList and LinkedList for lists, HashSet for unique values, HashMap for key-value test data, and Iterator for traversing them, for example collecting web elements in a list.
26

What is CI/CD and why does automation need it?

VisaMedium
Save to ▾
Show answer
Continuous Integration builds and tests every commit, and Continuous Delivery ships automatically. Automated tests give fast feedback and gate releases.
27

How do you take a screenshot on failure in TestNG?

VisaMedium
Save to ▾
Show answer
Implement ITestListener.onTestFailure(): File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); then copy it into the reports folder.
28

What are the different types of waits in Selenium?

VisaMedium
Save to ▾
Show answer
Implicit, explicit (WebDriverWait with ExpectedConditions) and fluent waits; avoid mixing implicit and explicit waits and never rely on Thread.sleep.
29

How would you automate a login flow with multiple user roles?

VisaHard
Save to ▾
Show answer
Keep credentials in external data, parameterise the test with a data provider, reuse a login method in a page class, and clear sessions between roles.
30

How would you design an automation framework from scratch?

VisaHard
Save to ▾
Show answer
Maven project → POM with a BasePage → driver factory with ThreadLocal → config files → data-driven utilities (Excel/JSON) → TestNG or Cucumber runner → logging → Extent reports with screenshots on failure → Jenkins pipeline.
31

What is the execution order of TestNG annotations?

VisaEasy
Save to ▾
Show answer
@BeforeSuite → @BeforeTest → @BeforeClass → @BeforeMethod → @Test → @AfterMethod → @AfterClass → @AfterTest → @AfterSuite.
32

How do you reduce flakiness in a CI pipeline?

VisaHard
Save to ▾
Show answer
Stabilise waits and data, isolate tests, use retries cautiously, quarantine unstable tests, run in consistent containers and track flaky rates.
33

What is the use of Maven in automation projects?

VisaMedium
Save to ▾
Show answer
It manages dependencies through pom.xml, builds the project, runs tests with Surefire and standardises structure across teams.
34

What is a constructor and can it be overloaded?

VisaMedium
Save to ▾
Show answer
A special method that initialises an object. It can be overloaded with different parameters, and testers use it to pass the WebDriver into page classes.
35

What are the advantages of version control for test code?

VisaMedium
Save to ▾
Show answer
Git tracks changes, enables code review, branching and rollback and lets teams collaborate on the framework safely.
36

How do you validate a JSON response in REST Assured?

VisaMedium
Save to ▾
Show answer
Use then().statusCode(200).body("data.id", equalTo(5)), or extract() the response and assert fields with JsonPath.
37

Explain your CI/CD pipeline for tests.

VisaHard
Save to ▾
Show answer
Code pushed to Git → Jenkins job triggers (webhook or schedule) → mvn clean test with the suite XML → reports and screenshots published → notifications on Slack/email → failures triaged before release.
38

How do you handle alerts and pop-ups?

VisaMedium
Save to ▾
Show answer
driver.switchTo().alert() lets you accept, dismiss, read text or send keys. Browser windows are handled with window handles.
39

How does HashMap work internally?

VisaMedium
Save to ▾
Show answer
It uses the key's hashCode to find a bucket and equals to resolve collisions, giving O(1) average lookups; Java 8 converts long buckets into trees.
40

How do you verify that an element is displayed, enabled or selected?

VisaMedium
Save to ▾
Show answer
Use isDisplayed(), isEnabled() and isSelected() on the WebElement before interacting or asserting.
41

What is the Page Object Model?

VisaEasy
Save to ▾
Show answer
A design pattern where each page is a class holding its locators and actions, so tests stay readable and a locator change is fixed in one place.
42

What are try-with-resources and why use them?

VisaMedium
Save to ▾
Show answer
A try block that automatically closes resources such as file readers or streams, preventing leaks without a finally block.
43

String vs StringBuilder?

VisaEasy
Save to ▾
Show answer
String is immutable — every change creates a new object. StringBuilder is mutable and faster for repeated changes (not thread-safe; StringBuffer is).
44

Tests pass locally but fail on Jenkins. Why?

VisaHard
Save to ▾
Show answer
Headless mode or screen resolution, timing issues, environment data, missing dependencies, browser–driver version mismatch or parallel conflicts. Check logs and failure screenshots and make waits robust.
45

What are access modifiers in Java?

VisaMedium
Save to ▾
Show answer
public (everywhere), protected (package and subclasses), default (package) and private (same class), used to control visibility of test utilities.
46

What is an API and what are common HTTP methods?

VisaEasy
Save to ▾
Show answer
An interface for systems to talk to each other. GET reads, POST creates, PUT replaces, PATCH updates partially and DELETE removes.
47

Difference between an abstract class and an interface?

VisaEasy
Save to ▾
Show answer
An abstract class can hold state and concrete methods; an interface defines a contract (with default methods since Java 8). A class extends one abstract class but can implement many interfaces.
48

What are listeners in TestNG?

VisaMedium
Save to ▾
Show answer
Classes like ITestListener that react to events such as test start, success or failure, commonly used for screenshots and reporting.
49

How do you test an API that depends on another service that is down?

VisaMedium
Save to ▾
Show answer
Use mocks or stubs such as WireMock to simulate the dependency and test your service in isolation.
50

How do you upload a file with Selenium?

VisaMedium
Save to ▾
Show answer
If the element is <input type="file">, use element.sendKeys("C:/path/file.pdf"). Use the Robot class or AutoIt only as a last resort for OS dialogs.
51

What are relative locators in Selenium 4?

VisaMedium
Save to ▾
Show answer
Locators such as above, below, toLeftOf and near that find elements by their position relative to another element.
52

How do you decide what to automate?

VisaHard
Save to ▾
Show answer
Automate stable, repetitive, high-risk and data-heavy flows (smoke, regression). Skip one-time tests, frequently changing UI and checks needing human judgement. Compare run frequency × manual time with build and maintenance cost.
53

What are the main OOP concepts in Java?

VisaEasy
Save to ▾
Show answer
Encapsulation, inheritance, polymorphism and abstraction. Testers use them to build reusable page classes, base tests and utility libraries.
54

What are exceptions and how do you handle them?

VisaEasy
Save to ▾
Show answer
Runtime events that disrupt flow. Use try-catch-finally, throw, throws, and custom exceptions; checked exceptions must be handled while unchecked ones need not be.
55

What is the difference between getText() and getAttribute()?

VisaMedium
Save to ▾
Show answer
getText returns visible inner text; getAttribute returns an HTML attribute or property such as value, href or class.
56

Method overloading vs overriding?

VisaEasy
Save to ▾
Show answer
Overloading: same method name, different parameters, in the same class (compile time). Overriding: a subclass redefines a parent method with the same signature (runtime polymorphism). WebDriver driver = new ChromeDriver() is runtime polymorphism.