Skip to content

elements.nth

elements.nth(index: number): Promise<DOMElement>

Section titled “elements.nth(index: number): Promise<DOMElement>”

Retrieves the element at the specified index.

  • index: The index of the element to retrieve.
  • Returns a promise that resolves to the DOMElement instance at the specified index.
  • If the index is out of bounds, the method throws an error.
  • The index is zero-based.
describe('Test script', function () {
it('Test 1', async () => {
const elements = await gf.getAll('.my-elements');
const element = await elements.nth(0);
});
});