Skip to content

gf.hasAttribute

gf.hasAttribute(selector: string, name: string): Promise<boolean>

Section titled “gf.hasAttribute(selector: string, name: string): Promise<boolean>”

Checks if the specified element has the specified attribute.

  • selector: The CSS selector of the element to check.
  • name: The name of the attribute to check for.
  • Returns a promise that resolves to true if the element has the attribute, false otherwise.
describe('Test script', function () {
it('Test 1', async () => {
const hasAttribute = await gf.hasAttribute('.my-element', 'data-id');
});
});