Anca Fologea
Anca Fologea

Reputation: 15

Selectors with data attribute

I'm having troubles creating a selector for the button with the data-qa attribute. See html:

<div class="stepsInfo_children__4knGx"><button type="button" class="steps_stepsButton__3Ykpu" data-qa="next-design">

I tried this implementation, with no success (from the official documentation): this.nextDesign = Selector("div").withAttribute("data-qa","next-design");

Upvotes: 0

Views: 1400

Answers (2)

pavelsaman
pavelsaman

Reputation: 8322

Alex is right, you missed it's actually a button.

Or you can avoid withAttribute() and create the following selector:

this.nextDesign = Selector('[data-qa="next-design"]');

it's a bit shorter, which might make it a bit more readable.

Upvotes: 2

Alex Skorkin
Alex Skorkin

Reputation: 4274

You try to create a selector for the button, but you create it for a div element. It looks like you meant this:

this.nextDesign = Selector("button").withAttribute("data-qa","next-design");

Upvotes: 1

Related Questions