I am trying to build an array from text in the td's of a table row and trying to find a less clunky way of doing it.
test('Check first row', async() => {
let firstRow =[];
firstRow = await page.evaluate(() => $('table tbody tr:first-child td:nth-child(3)').text());
firstRow += ', ' + await page.evaluate(() => $('table tbody tr:first-child td:nth-child(4)').text());
firstRow += ', ' + await page.evaluate(() => $('table tbody tr:first-child td:nth-child(5)').text());
console.log(firstRow);
// desired result "firstTdText, nextTdText, nextTdText"
});
Aucun commentaire:
Enregistrer un commentaire