Если вы знали, что номер столбца вашей таблицы всегда один и тот же, то вы можете зациклить его, выбрав только td. Сделать цикл внутри цикла сложно, и в основном он медленнее, чем один цикл. Например, ваша таблица содержит 5 столбцов.
let this_row, this_col;
let column = 5; // Specify your column number here
const data = await page.$$('.CalendarMonthGrid > :nth-child(1) > div > table > tbody > tr > td');
for (let i = 0; i < data.length; i++) {
// Here you can find row number for every td by doing this
this_row = Math.ceil( (i + 1)/column )
// Here you can find column number by doing this
this_col = (i + 1) % column
}
Если ваша таблица динамическая и имеет неизвестное количество столбцов и строк, то ваш код будет выглядеть следующим образом.
let this_row, this_col;
const data = await page.$$('.CalendarMonthGrid > :nth-child(1) > div > table > tbody > tr > td');
const row_num = (await page.$$('.CalendarMonthGrid > :nth-child(1) > div > table > tbody > tr > td:nth-child(1)')).length;
const column = data.length / row_num;
for (let i = 0; i < data.length; i++) {
// Here you can find row number for every td by doing this
this_row = Math.ceil( (i + 1)/column )
// Here you can find column number by doing this
this_col = (i + 1) % column
}