Skip to content
QA Knowledge Hub

findElement vs findElements in Selenium

Updated 2026-11-13 · 2 min read

Understand first-match lookup, lists, missing elements and why finding an element does not prove it is visible. Includes a comparison table, concrete examples and an interview answer.

The difference in one table

AspectfindElementfindElements
Java return typeWebElementList of WebElement references
If several matchReturns the first match in the search contextReturns the matching elements
If none matchThrows NoSuchElementException after applicable waitingReturns an empty list after applicable waiting
Typical useLocate a required controlInspect a group or check optional presence
Not guaranteedUniqueness or visibilityCompleteness of a list that is still loading

Examples

findElement: locate a required checkout button with a stable identifier. If the locator matches two buttons, receiving one element does not establish uniqueness. A broad locator could silently target the wrong control.

findElements: inspect the currently matched cart rows and compare their count and details with the expected cart. An empty result can be correct for an empty cart, but may also mean the table has not loaded. Wait for the application's loaded state before deciding.

For an optional banner, a list lookup can express “zero or more matches” without using a missing-element exception as ordinary control flow. Still assert the right presence or absence for the scenario.

How to answer in an interview

In Selenium Java, findElement returns the first matching element and throws NoSuchElementException if no match is found after applicable waiting. findElements returns a list, which is empty when there are no matches. I use the singular form for a required control and the plural form when the test needs a group or a count. Neither proves visibility, uniqueness or that asynchronous loading has finished.

Common confusion

An empty list is not a blanket guarantee that no exception can occur: an invalid selector, stale search context or closed session can still fail. A stored list also does not automatically refresh after the page changes. Refetch elements when the test needs the new DOM state.

Likely follow-up: How do you assert a control is unique? Use the matching collection and assert exactly one result after the relevant readiness condition, then inspect the intended element.

Quick answers

Does findElements always return immediately?

No. With an implicit wait configured, an empty search can wait. It can return as soon as matches exist rather than waiting for the final expected count.

Does finding an element mean it can be clicked?

No. Presence, visibility and interactability are different. Check the state required for the action.

Sources

Want a project you can show in interviews?

The portfolio project kit walks you through testing a deliberately buggy app with Selenium or Playwright and API tests, then explaining it. The app itself is free.