Search for multiple elements on the page, starting from the document root. The located elements will be returned as web element JSON objects (with an added .getId() convenience method).
First argument is the element selector, either specified as a string or as an object (with 'selector' and 'locateStrategy' properties).

For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.

Usage

browser.findElements(selector, [callback])
await browser.findElements(selector);

Example

Or run locally with:
git clone https://github.com/nightwatchjs/nightwatch-examples.git
cd nightwatch-examples
npm install
npx nightwatch tests/api/findElements.js

Parameters

Name Type description
selector string

The search target.

callback
Optional
function

Callback function to be invoked with the result when the command finishes.

W3C WebDriver spec