I’m looping through a series of elements (changesEl) that have one input each, and then checking to see if the array of input actions finds it by name.
For each element you find you should click. However, in this test I do, it should be clicked twice because there are two actions that match, but only one is clicked, but both are searched.
What could be the problem?
I tried this:
export async function stageRecentChanges_v2(page: Page, actions: CampaignsInfoStatus[], isDelete: boolean) {
await page.waitForSelector('table.clickable-rows tr.one-list-item table span');
const changesEl = await page.$$('table.clickable-rows tr.one-list-item');
const encontrados = [];
for (let i = 0; i < changesEl.length; i++) {
const changeName = await changesEl[i].$eval('table.clickable-rows tr.one-list-item table span', e => (<HTMLElement>e).innerText);
console.log(`changeName ${changeName}`);
if (actions.some(a => a.info?.name == changeName)){
console.log(`changesEl[i] ${changesEl[i]}`);
const input = await changesEl[i].$('input');
if(input){
await input.click(); //clica todos los inputs que coinciden con las actions a dar de alta
}
encontrados.push(changesEl[i]);
}
}