elements.first
elements.first(): Promise<DOMElement>
Section titled “elements.first(): Promise<DOMElement>”Retrieves the first element in the array.
- Returns a promise that resolves to the first
DOMElement
instance in the array. - If the array is empty, the method throws an error.
describe('Test script', function () { it('Test 1', async () => { const elements = await gf.getAll('.my-elements'); const element = await elements.first(); });});