Bank of America Selenium Interview Questions with Answers

Download Bank of America Selenium Interview Questions PDF

Prepare for Bank of America interviews with 64 curated questions. The answer examples below explain key concepts; personalize project and experience responses truthfully. These are independent study resources, not official company interview materials.

Interview Questions with Answer Explanations

These study answers summarize the associated PDF material. Adapt personal, project and experience details to your own background.

Explain your experience in automation

Explain the business flows automated, tools used, framework design, test data, reporting, CI execution, and your contribution. A strong answer describes an end-to-end example: requirement → scenario/test case → automation code → execution → defect triage → report. Mention measurable benefits only when you have evidence. Do not claim tools or ownership you have not personally used.

Role in automation

Typical responsibilities can include analysing automation candidates, estimating effort, creating reusable page objects/utilities, writing and reviewing scripts, managing test data, running smoke/regression suites, debugging flaky failures, logging defects, integrating with CI, and reporting results. For a lead role, include code reviews, prioritisation, mentoring, risk tracking, and coordination. Tailor the answer to your actual responsibilities.

Registration page: click link, fill fields from external data, submit

Use a Page Object for locators and a data reader for external values. This example uses a CSV file to keep the Selenium flow independent of the data source. Create src/test/resources/registration.csv with a header row and one data row: firstName,lastName,email,password then the values. For real applications, use synthetic test accounts and never commit real passwords.

Explain every line in the registration code

new ChromeDriver() starts a Chrome session; maximize() enlarges the window; get() navigates to the application; CsvReader.readFirst(...) reads one record from the external file into a data object; findElement(By.linkText(...)) locates the Register link and click() opens the form; each findElement(By.id(...)).sendKeys(...) locates a field by its ID and types the matching value; the final click submits the form. In production, add explicit waits, validate the result, and close the driver in teardown.

Read 10 different test data sets for the registration scenario

Use a loop or TestNG @DataProvider to supply one row per test execution. The preferred approach is to read all rows once and return an Object[][] so TestNG reports each dataset as a separate invocation. Each row should use a unique email if the application prevents duplicate registrations. Do not share mutable data between parallel tests.

Get the count of all links in a web page

Use findElements(By.tagName("a")) and read the list size. findElements returns an empty list when nothing matches, so it is safer than findElement for counting. If the page loads links dynamically, wait for the relevant page state first.

Read data from Notepad/text file

A plain text file can be read using Java NIO Files.readAllLines or Files.lines. Use a path relative to the project or a configured external path. Ensure file encoding is known, and close streams (try-with-resources is preferred). For multiple test records, define a delimiter and validate each row.

Read a file from a network location such as SharePoint

The approach depends on how the organisation exposes the document. If it is a synced SharePoint library, the file may be accessible as a local path, subject to permissions and sync status. For a secure cloud SharePoint site, prefer the approved SharePoint/Graph API or a company connector using OAuth and least-privilege access; do not hard-code passwords or scrape login pages. Download to a controlled temporary location, validate the file, and delete it when no longer needed.

Requirement analysis: review requirements, acceptance criteria, dependencies, and ambiguities. 2) Test

planning: define scope, approach, resources, schedule, environments, risks, and entry/exit criteria. 3) Test design: prepare scenarios, cases, test data, and traceability matrix. 4) Environment setup: verify builds, configuration, accounts, and integrations. 5) Execution: run tests, record evidence, compare actual vs expected, and log defects. 6) Defect retest and regression: verify fixes and check for side effects. 7) Closure: summarise coverage, defects, residual risks, lessons learned, and sign-off. In Agile these activities repeat each sprint.

Defect life cycle

A typical lifecycle is New/Logged → Assigned → Open/In Progress → Fixed/Resolved → Retest → Verified/Closed. If the fix fails, the defect is Reopened. Other possible states include Rejected/Invalid, Duplicate, Deferred, Cannot Reproduce, and Won’t Fix. Exact states depend on the team's workflow.

Instantiate ChromeDriver

In Selenium 4, Selenium Manager can resolve a compatible driver in supported environments. Configure ChromeOptions when needed, create the driver, and quit it in teardown. Browser and driver compatibility plus network restrictions can affect setup. ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized");.

Client calls with onsite team

Answer truthfully. If yes, describe the purpose (requirement clarification, defect triage, demo, status update), your contribution, and the outcome. If no, say you have mainly coordinated through your delivery team and are comfortable joining client calls; give an example of stakeholder communication you have handled. Never invent client-facing experience.

Maven, Git, Jenkins

Maven manages dependencies and build lifecycle through pom.xml, and can compile/package/run tests. Git is distributed version control used to track changes, branch, merge, and review code. Jenkins is a CI automation server that can check out code, run Maven tests, publish results, and notify the team. Together: a code change is committed to Git; Jenkins checks it out and runs mvn clean test; results and reports are published.

Round 2: Limitations of Selenium

Selenium automates web browsers; it does not directly automate native desktop applications. It does not include a complete test runner, reporting platform, or test-data management solution, so teams integrate TestNG/JUnit, reporting tools, and build systems. CAPTCHA/OTP are security controls and should be handled through approved test hooks or test environments, not bypassed in production. Dynamic DOMs, timing, browser differences, and remote execution can create flaky tests unless locators, waits, data, and sessions are designed carefully.

Code for taking screenshot

Cast the driver to TakesScreenshot, capture a temporary image file, create the target folder, and copy the image to the chosen path. Use unique names for repeated/parallel tests. File source = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); Path target = Path.of("test-output", "failure.png"); Files.createDirectories(target.getParent()); Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);.

Handle JavaScript alert

Use driver.switchTo().alert() to accept, dismiss, read text, or enter a prompt value. Wait for the alert to be present when it appears asynchronously. This is for browser JavaScript alerts, not HTML modal dialogs.

Handle multiple windows

Store the parent handle, trigger the child window, wait for handle count to increase, switch to the handle that differs from the parent, perform the action, then return to the parent. If several children can open, identify the correct one by title or URL rather than assuming handle order.

Annotations in TestNG

Common annotations: @BeforeSuite/@AfterSuite, @BeforeTest/@AfterTest, @BeforeClass/@AfterClass, @BeforeMethod/@AfterMethod, @Test, @DataProvider, @Parameters, @Factory, @Listeners, and @BeforeGroups/@AfterGroups. Setup/teardown annotations run at different scopes. @Test marks a test method; @DataProvider supplies datasets. The exact order should be verified against the suite structure and TestNG version.

Hierarchy/order of TestNG annotations

At a high level: suite setup (@BeforeSuite), test-tag setup (@BeforeTest), group setup (@BeforeGroups when applicable), class setup (@BeforeClass), method setup (@BeforeMethod), test method (@Test), then matching after-method, after-class, after-test, and after-suite methods. Group hooks only apply to relevant groups, and factories/data providers can affect invocation counts. Do not confuse @BeforeTest with “before every @Test”: it runs before the <test> section in testng.xml.

Defect retesting vs regression testing

Retesting (confirmation testing) reruns the failed test after a specific defect fix to confirm the original issue is resolved. Regression testing runs related or broader existing tests to ensure the change has not broken other functionality. Example: after fixing a login lockout bug, retest the lockout steps; regression might include valid login, password reset, session timeout, and role-based access.

Database testing

Database testing checks data integrity, constraints, CRUD operations, stored procedures, transactions, migration, and consistency between UI/API and database. Use SQL to verify records and joins, confirm primary/foreign keys, test null/duplicate rules, and validate rollback/commit behaviour where applicable. Use read-only access and approved test environments; avoid changing production data. Example: submit an order through the UI, then verify the order row and status in the test database.

Which project is in which domain?

Explain the business domain, product users, and important workflows rather than only naming the project. Examples: banking—accounts, payments, lending; travel/visa services—application submission, appointment booking, document scanning and verification; retail—catalogue, cart, payment, fulfilment. Use the domain that genuinely matches your project, and explain two business rules you tested.

Run smoke tests alone from 100 mixed scenarios using TestNG

Use TestNG groups: mark smoke methods with groups = {"smoke"} and run only that group through testng.xml or Maven Surefire configuration. Keep smoke tests independent and fast. Sanity is a separate group if the team defines it separately.

Reports maintained in a project

Answer according to your project. Common outputs include TestNG/JUnit execution reports, Cucumber HTML/JSON reports, ExtentReports, screenshots for failures, defect dashboards, daily execution status, traceability/coverage reports, and CI build reports. Explain what the report shows, who uses it, and how failures are investigated. Avoid claiming a reporting tool you did not use.

Tell me about yourself (second version)

For a second-round interview, make it more technical: “My background combines functional testing and automation. I use Java and Selenium to build maintainable browser tests, with page objects, explicit waits, data-driven execution, assertions, and reporting. I also participate in requirement analysis, defect triage, regression planning, and Agile ceremonies. I focus on making automation reliable and useful for release decisions rather than just increasing script count.” Add one real achievement if you can substantiate it.

Read Excel using Apache POI

Apache POI reads Excel workbooks. Use WorkbookFactory to support .xls and .xlsx, then access sheet/row/cell. Handle blank cells and types carefully; for dates/formatted values, DataFormatter often provides a display string. Always close the workbook/input stream with try-with-resources. try (InputStream in = Files.newInputStream(Path.of("testdata.xlsx")); Workbook workbook = WorkbookFactory.create(in)) { Sheet sheet = workbook.getSheet("Registration"); DataFormatter formatter = new DataFormatter(); Row row = sheet.getRow(1); // second row, after header.

What annotations are available in TestNG?

See Question 19 for the common lifecycle annotations. In addition, @Test attributes include groups, dependsOnMethods, priority, dataProvider, enabled, timeOut, invocationCount, expectedExceptions, and successPercentage (with caveats). Use annotations to express test metadata and lifecycle, not as a substitute for clear test design.

When to use successPercentage in TestNG

successPercentage defines an allowed success rate for repeated invocations of a test, often alongside invocationCount. It is rarely appropriate for deterministic functional tests because a flaky test should normally be fixed rather than accepted. It can be useful for a deliberately probabilistic or reliability-style test when the team has defined an acceptable pass threshold. Explain the risk of masking intermittent failures.

Defect lifecycle (repeat)

Explain the flow: logged/new → triage/assigned → open/in progress → fixed/resolved → retest → verified/closed. If it still fails, reopen it. Other states depend on the tool and process. Severity describes impact; priority describes urgency.

Click a link in another window

Switch to the target window before finding/clicking the link. Store the original handle, wait for the new window, switch, then locate the link in that window. If the link itself opens a third window, repeat the same pattern. You cannot interact with elements in a non-current window context.

Selenium locators: least and most preferred

Selenium's standard locator strategies are id, name, className, tagName, linkText, partialLinkText, cssSelector, and xpath (eight). There is no universal “least prepared” or “most preferred” locator ranking: stability and uniqueness matter. A stable unique ID or dedicated test attribute is usually easiest to maintain. Absolute XPath is often fragile; relative XPath can be useful for relationships.

Challenges faced in Selenium

Choose real examples and explain problem → root cause → action → outcome. Common issues: flaky timing, changing DOM/locators, overlays, test data conflicts, OTP/captcha restrictions, browser compatibility, and parallel execution. Prefer explicit waits, stable locators, isolated data, diagnostics, and collaboration with developers over adding fixed sleeps. Mention only challenges you have genuinely faced.

Report used in your project

State the actual report tool, e.g., TestNG default reports, Cucumber HTML, ExtentReports, or CI test-result publishing. Explain how a report shows passed/failed/skipped tests, error details, execution time, and screenshots/logs where configured. If you used multiple reports, describe the audience for each (developer debugging vs stakeholder status).

BDD, TDD, and DDD

BDD (Behaviour-Driven Development) describes behaviour using examples understandable to business and technical stakeholders; Gherkin Given/When/Then is commonly used. TDD (Test-Driven Development) writes a failing test first, then code to pass it, then refactors. DDD (Domain-Driven Design) structures software around a shared domain model and ubiquitous language. They are different concepts and can coexist; Cucumber is commonly associated with BDD, not automatically with TDD or DDD.

Explain a feature file

A Cucumber feature file is a .feature text file written in Gherkin. It describes a feature and scenarios using business-readable steps. Step definitions bind the steps to Java code. Keep scenarios focused on observable behaviour and avoid embedding implementation details or excessive UI mechanics.

Keywords in a Gherkin feature file

Common keywords: Feature, Rule, Background, Scenario, Scenario Outline, Examples, Given, When, Then, And, But, and *. Given sets context, When describes an action/event, and Then describes an expected outcome. Background steps run before each scenario in the feature; Scenario Outline runs the same scenario with rows from Examples. @tag labels scenarios for selection.

Pass parameters from outside a class

Common ways are constructor parameters, method parameters, configuration files/environment variables, dependency injection, or TestNG @Parameters/@DataProvider. Prefer explicit constructor/method injection for dependencies and configuration for environment-specific settings. Avoid mutable global variables where possible because they make tests harder to isolate.

findElement vs findElements

findElement(By) returns the first matching WebElement and throws NoSuchElementException if no match exists. findElements(By) returns a list of all matches, or an empty list if none exist. Use findElement when one element is required; use findElements for counting, iterating, or optional elements. Neither method by itself waits for a specific business condition.

What is relative XPath?

Relative XPath starts from any matching node in the DOM using //, rather than following the full path from the document root. It is usually more maintainable than an absolute XPath such as /html/body/div Use meaningful attributes, text, and relationships, and avoid long index-dependent paths.

Explain following-sibling

The XPath following-sibling:: axis selects sibling nodes that appear after the context node and share the same parent. It does not select descendants or elements under a different parent. Add a predicate to select the desired type or index.

Eight Selenium locator strategies with examples

The standard strategies are ID, name, class name, tag name, link text, partial link text, CSS selector, and XPath. Prefer stable unique identifiers. className expects one class token, not a string containing multiple classes. Link-text locators apply to anchor links. XPath is powerful for text and DOM relationships but should remain readable.

Drag and drop

Use Selenium's Actions API. The source and target must be visible and interactable. Some modern HTML5 or JavaScript drag-and-drop widgets may not respond to native actions in every browser; in that case inspect the widget's supported interaction and avoid JavaScript hacks unless justified.

Find total number of URLs/links on a page

If “URLs” means anchor destinations, count anchor elements and optionally read each href. Some anchors may have no href, and links may be duplicated. Clarify whether the requirement is number of anchor tags, unique URL values, or only valid HTTP(S) links.

Current Java version and previous-version differences

State the version actually used by your project and confirm it from java -version, Maven compiler settings, and CI agent configuration. For example, if the project uses Java 17 and the previous LTS was Java 11, discuss features introduced between those versions. Java 17 highlights include records (finalised in 16), sealed classes (finalised in 17), text blocks (finalised in 15), switch expressions (finalised in 14), and pattern matching for instanceof (finalised in 16). Java 17 also removed the old Applet API and Security Manager was deprecated for removal.

Given an array

The prompt is incomplete: the interviewer likely supplied an array and asked for a particular operation (sort, reverse, find max, remove duplicates, etc.). Ask what output is expected. A common baseline example is to iterate through an array and print each value.

Create a Jenkins build

Create a Freestyle or Pipeline job, connect source control, configure credentials, choose an agent, run build/test commands, and publish reports. Prefer Pipeline-as-Code with a Jenkinsfile checked into the repository. Test the job manually, then configure webhook or schedule triggers. Store secrets in Jenkins credentials, not source code. pipeline { agent any stages { stage('Checkout') { steps { checkout scm } } stage('Build and Test') { steps { sh 'mvn clean test' } }.

Jenkins plugins required

Plugins depend on the pipeline and organisation. Common choices are Pipeline, Git, Credentials Binding, JUnit (often bundled), and plugins for the specific report format or notifications. Maven Integration may be useful for some job styles. Install only approved, maintained plugins, review permissions and updates, and avoid installing unnecessary plugins because each adds maintenance/security exposure.

Version control software used in projects

If you use Git, explain repository, working tree, staging, commit, push, pull/fetch, branch, merge/rebase, pull request, and conflict resolution. Typical flow: create a feature branch, commit small changes, push, open a pull request, get review, resolve conflicts, and merge according to team policy. Keep secrets and generated test artifacts out of the repository.

What is Bitbucket?

Bitbucket is a Git-based source code hosting and collaboration platform. Teams use it for repositories, branches, pull requests, code review, access controls, and integrations with build systems such as Jenkins. It hosts Git repositories; Git is the version-control system itself. Bitbucket Cloud and Bitbucket Data Center have different hosting and administration models.

Prime number program

A prime number is an integer greater than 1 with no positive divisors other than 1 and itself. It is enough to test divisors up to the square root of the number. Handle values less than 2 as not prime. int n = 29; boolean prime = n >= 2;.

Change lowercase to uppercase and uppercase to lowercase

Use Character.isLowerCase, Character.isUpperCase, and the corresponding conversion methods. Preserve digits and punctuation unchanged. This example handles Java char values; advanced Unicode text may need code-point-aware processing.

Open browser with customised settings

Use browser-specific Options classes to configure arguments and preferences before creating the driver. Common settings include headless mode, download directory, browser language, proxy, certificate handling, and window size. Apply only settings approved for the test environment; disabling security checks can hide real issues. ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized"); options.addArguments("--lang=en-US");.

Go directly to homepage if previous session was logged in

This depends on how the application manages sessions. If a valid session cookie is persisted by the browser, the application may redirect directly to the home page; test this through supported application behaviour. Selenium cookies can be saved and restored in a controlled test, but cookies are authentication secrets and must never be committed or shared. A safer approach is often API-based login or a dedicated test-session mechanism provided by the application.

Secure Maven JAR artifact before pushing to Git

Do not commit generated JARs to source Git unless the repository policy explicitly requires it; publish artifacts to an approved artifact repository. Security steps include dependency vulnerability scanning (for example, approved SCA tooling), secret scanning, malware scanning of externally supplied files, signed/checksummed artifacts where supported, protected branches and pull-request review, least-privilege tokens, and CI controls. Keep credentials in a secret manager/Jenkins credentials. A JAR is not made safe simply by putting it in Git; validate dependencies, build provenance, and artifact integrity.

Access modifiers

public is accessible from anywhere allowed by module/package rules; protected is accessible within the same package and by subclasses (with Java's subclass access rules); package-private (no modifier) is accessible only within the same package; private is accessible only within the declaring class. Use the narrowest access that satisfies the design.

Can a protected method be accessed from a subclass?

Yes. A subclass can access an inherited protected method, including from another package, subject to Java's protected-access rules. From another package, access is through inheritance and the qualifying reference must be appropriate to the subclass context; it is not unrestricted access to any arbitrary superclass instance. package a;.

Move browser window to a different position

Use WebDriver's window management API. Coordinates are pixels from the screen's top-left, but window managers, remote grids, and headless browsers may ignore or constrain positioning.

XPath text inside a paragraph inside a div

If the text is in a <p> nested inside a <div>, select the paragraph by its text or by a stable parent relationship. normalize-space(.) checks combined descendant text and normalises whitespace. If you want the paragraph element itself, use the first expression; use getText() to read the rendered text.

Set vs List

List preserves sequence and allows duplicates and index access. Set models uniqueness and has no index-based access. ArrayList is a common List; HashSet is common for uniqueness but has no guaranteed order; LinkedHashSet preserves insertion order; TreeSet sorts elements. Choose based on the requirement.

StringBuffer vs StringBuilder

Both are mutable character sequences. StringBuffer synchronizes methods and is thread-safe for individual operations; StringBuilder is not synchronized and is usually faster when only one thread uses it. Use StringBuilder for loops that build strings; use StringBuffer only when its synchronization fits the shared-access need. StringBuilder sb = new StringBuilder("Test"); sb.append(" Automation");.

Interface

An interface defines a contract that implementing classes must fulfil. A class can implement multiple interfaces but extend only one class. Interfaces support loose coupling: code can depend on a contract rather than a concrete implementation. In Selenium, WebDriver is an interface implemented by browser-specific drivers.

Are public static void main and static public void main both valid?

Yes. Java permits modifiers such as public and static in either order in a method declaration, so both are valid. The conventional and most commonly used order is public static void main(String[] args). The method is the standard entry point for launching a Java application.

Questions

  1. Tell about yourself
  2. Explain your experience in Automation
  3. Role in Automation
  4. Write a program for registration page : Click on register link in web page. Then fill all the fields with external data source. Finally click on submit.
  5. Explain each and every line. what it will do [4].
  6. In the same scenario[4] , how you read the data for 10 different test data.
  7. How to get count of all the links in web page
  8. How to read the data from Notepad.
  9. How to read the file which is present in Network [Like SharePoint].
  10. Explain manual testing cycle from requirement
  11. Defect Life cycle
  12. How to instantiate Chrome driver.
  13. Did you attend any Client calls from Onsite
  14. What is Maven, Git, Jenkins
  15. Round - 2:-
  16. Limitations of Selenium
  17. Write a code for taking screenshot
  18. How to handle Alert
  19. How to handle multiple windows
  20. Annotations in TestNg
  21. Hierarchy of TestNg
  22. Diff bw 'Defect Retesting' and 'Regression Testing'
  23. Do u know Database testing
  24. Which project is in which domain
  25. If u have 100 scenarios. In that u have mixture of smoke and sanity scenarios. want to run smoke alone. How to handle this with TestNg.
  26. What are the reports u r maintaining
  27. Tell me about yourselF
  28. How to read data from an excel? Write code and explain?
  29. What are the annotations available in TestNG?
  30. One question on when to use 'Success percentage' attribute in TestNG
  31. Explain Defect Lifecycle
  32. sceniario: clicking on a link in a Window will take you to another window.i want to click a link in another window. how will you do that?
  33. what are locaters available in Selenium? Which is the least prepared, most prepared & how?
  34. what are the challenges you faced in selenium?
  35. what is the report used in your project?
  36. Explain what is BDD,TDD, DDD
  37. Explain the feature file
  38. What are the keywords in feature file.
  39. How would you pass the parameters from outside a class.
  40. Difference between find elements and find element.
  41. What is relative xpath.
  42. Explain following-sibling.
  43. How many locaters are present in selenium and explain each with an example.
  44. How would you do drag and drop
  45. How will you find the total number of url's in a page
  46. I was asked what version of java that is been currently used in my projects..and the question was the difference between the current version I'm using and it's previous version..what are the new features ?
  47. Given an array
  48. How will you create a jenkins build.
  49. What are the plugins required for Jenkins.
  50. Explain about the version controlling software you use in your projects.
  51. What is bit bucket.
  52. Write a program to find whether a given number is prime or not
  53. Program to change lowercase letters to uppercase and vice versa.
  54. How to Open browser with some customized settings?
  55. How to go to homepage directly if in previous session we logged in?
  56. Maven build jar file to push to GIT how to secure from virus or hackers?
  57. Access modifiers
  58. Protected method can be acces if class extend from another class?
  59. Window move to different position?
  60. Xpath of text if there is paragraph inside div tag and in paragraph there is a text, how to get that text
  61. Set and list
  62. String buffer and string builder
  63. Interface
  64. Public static void main-- static public void both are correct?

Back to Company Wise Interview Questions