0

In selenium query for selector, if my selector value was (#div-id a). It return all a tags. Does in testcafe is it posible this to selector function? i just want to avoid looping to get all a tags.

Code Sample

const element = selector('#div-id').find()
var get = await brandUrls.hasAttribute();
console.log(get);

Actual element attached enter image description here

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47

1 Answers1

1

Yes, it is also possible to achieve the desired behavior with TestCafè in a similar way:

import { Selector } from "testcafe";

// one option
const firstLinkSelector = Selector("#directoryLink-1 a");

// another option
const secondLinkSelector = Selector("#directoryLink-1").find("a");

Read more about the find()-method here.

Martin H.
  • 538
  • 1
  • 7
  • 21