I would like to test if a page has the following div.
<div class="evs-embedded-card" data-id="10">some text</div>
How can I test to see if there is a div present that has both class="evs-embedded-card"
and data-id="10"
?
I would like to test if a page has the following div.
<div class="evs-embedded-card" data-id="10">some text</div>
How can I test to see if there is a div present that has both class="evs-embedded-card"
and data-id="10"
?
You can use Document.querySelector()
by specifying the class and attribute selector for the custom attribute without any space in between them.
var el = document.querySelector('.evs-embedded-card[data-id="10"]');
console.log(el);
<div class="evs-embedded-card" data-id="10">some text</div>