Updated error handling and logging.

This commit is contained in:
2026-04-14 18:28:29 +05:00
parent 3cb7ba3092
commit 46e793135f
+4 -2
View File
@@ -90,12 +90,14 @@ while (!debug && (currentDateTime < lowerBound || currentDateTime >= upperBound)
await page.Locator("div.flex.items-center.justify-end > div > div:nth-child(2) > svg").ClickAsync();
try
{
await page.Locator("div.grid.bg-gray-100.rounded-lg.anim").Filter(new () { HasText = endTime }).ClickAsync( new() { Timeout = 1000 });
Console.WriteLine($"{DateTime.Now:HH:mm:ss}: Clicking next for tomorrow's time slots...");
await page.Locator("div.grid.bg-gray-100.rounded-lg.anim").Filter(new () { HasText = endTime }).ClickAsync( new() { Timeout = 2000 });
Console.WriteLine($"{DateTime.Now:HH:mm:ss}: Timeslot found and clicked.");
}
catch (PlaywrightException)
{
Console.WriteLine($"{DateTime.Now:HH:mm:ss}: Could not find the specified end time slot: {endTime}");
await page.ScreenshotAsync(new PageScreenshotOptions { Path = "ErrorScreenshot.png" });
Console.WriteLine($"Could not find the specified end time slot: {endTime}");
return;
}