I need to go through a group of tags that have a specific class associated with them and have a value
<div class="ratinglabel col-6">
<label>Area 1: Professional Engagement
<span test-data="area_1_Scor">
(4/16)
</span>
</label>
</div>
and i want to find (4/16*5) and save them in var to compare them with another value
i did this :
cy.get('[test-data="area_1_Scor"]', { timeout: 2000 })
.then(function($ele) {
var countOfElements = $ele*5;
cy.log(countOfElements);
});
})
and
cy.get('[test-data="area_1_Scor"]').each(($li, index, $lis) => {
var sum = 0;
Cypress.$('[test-data="area_1_Scor"]').each(function() {
sum = +Cypress.$(this).text()*5||0;
});
cy.log("Total sum of all span elements:"+sum);
})
but log appear as NaN in first case and 0 in second So how can i do it ?