If I try to click an element like this I get an error:
const handle = await page.$('.days-label.col-md-12.desktop div:nth-child(1)');
await handle.click();
However if I click it like this it works:
await page.$eval('.days-label.col-md-12.desktop div:nth-child(1)', el => el.click());
I tried fixing it by waiting for selector and navigation, but it's still the same error:
await page.waitForSelector('.days-label.col-md-12.desktop div:nth-child(1)');
const handle = await page.$('.days-label.col-md-12.desktop div:nth-child(1)');
await Promise.all([
page.waitForNavigation(),
handle.click(),
]);
waitForSelector() returns <Promise<?ElementHandle>>:
const handle = await page.waitForSelector(
'.days-label.col-md-12.desktop div:nth-child(1)'
)
await Promise.all([
page.waitForNavigation(),
handle.click(),
])