element.hasAttribute
element.hasAttribute(name: string): Promise<boolean>
Section titled “element.hasAttribute(name: string): Promise<boolean>”Checks if the element has the specified attribute.
name: The name of the attribute to check for.- Returns a promise that resolves to
trueif the element has the attribute,falseotherwise.
describe('Test script', function () { it('Test 1', async () => { const element = await gf.get('.my-element'); const hasAttribute = await element.hasAttribute('data-id'); });});