Updated error handling and logging.
This commit is contained in:
+4
-2
@@ -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();
|
await page.Locator("div.flex.items-center.justify-end > div > div:nth-child(2) > svg").ClickAsync();
|
||||||
try
|
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)
|
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" });
|
await page.ScreenshotAsync(new PageScreenshotOptions { Path = "ErrorScreenshot.png" });
|
||||||
Console.WriteLine($"Could not find the specified end time slot: {endTime}");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user