I'm trying to add some numbers that are coming from a DIV but I'm unable to add it cause it gives me an [object object][object object] added together and when I tried to String it gives me an Object object and with Number or ParseInt, I get NaN
Testcode:
<div class="test1">
<div> Title </div>
<div>13</div>
</div>
When I do this let patientNum1 = Selector('test').child('div').nth(1).textContent;
and do something like .expect(patienNum1).eql(5) it would actually output "Expected 13 to equal 5" my goal is to get that 13 and add it with another similar divclass (test1) with one another.
My goal stops here:
let newNum = patientNum1 + patientNum2;
await t
.expect(newNum).eql(15);
AssertionError: expected '[object Object][object Object]' to deeply
equal 15
let newNum = parseInt(patientNum1) + parseInt(patientNum2);
await t
.expect(newNum).eql(15);
1) AssertionError: expected NaN to deeply equal 15
Any ideas?
Aucun commentaire:
Enregistrer un commentaire