I have some pages in my context. I trigger multiple requests like this, without waiting to complete/load the page:
//Trigger without await
page1.GotoAsync("https://slowWebsite.com");
page2.GotoAsync("https://fastWebsite.com");
//page3 you stay idle yet
Question: How to find the idle pages? Suppose fastWebsite.com
loads after 1 second, and slowWbsite.com
loads completely after 6 seconds. At second 2, I need to find idle/free/completed
pages and make them do some new tasks:
foreach (IPage page in pages)
{
//if page is free/idle and is not waiting to load something and I need to get page2 and page3
};
Currently I check to find some elements on the page but It doesn't work for page3 or pages which have error connection/response failed and page is idle :
if (await page.Locator("id=HelloStacky").CountAsync() > 0)
{
//This page is completed and free for new jobs
}