In Puppeteer you can evaluate async functions:
await page.evaluate(async () => {
// await some promise
});
Is there an equivalent in PuppeteerSharp? Using EvaluateFunctionAsync
, the task completes before the promise resolves:
await page.EvaluateFunctionAsync(@"async () => {
// await some promise
}");
That's the right way, for example:
var six = await page.EvaluateFunctionAsync<int>("async () => await Promise.resolve(6)");