Compare commits

..

10 Commits

4 changed files with 14 additions and 2 deletions
+1
View File
@@ -1,6 +1,7 @@
[Pp]assword.txt [Pp]assword.txt
CVV.txt CVV.txt
CardDetails.txt CardDetails.txt
run.bat
# ---> VisualStudioCode # ---> VisualStudioCode
.vscode/* .vscode/*
+1
View File
@@ -58,6 +58,7 @@ public static class GoogleMessages
string messageText = await messageElement.InnerTextAsync(); string messageText = await messageElement.InnerTextAsync();
await originalPage.BringToFrontAsync(); await originalPage.BringToFrontAsync();
await msgPage.CloseAsync();
return messageText; return messageText;
} }
} }
+8
View File
@@ -54,6 +54,7 @@ try
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"Error during login: {ex.Message}\nAssuming already logged in, proceeding with booking..."); Console.WriteLine($"Error during login: {ex.Message}\nAssuming already logged in, proceeding with booking...");
await page.CloseAsync();
return; return;
} }
@@ -98,6 +99,7 @@ catch (PlaywrightException)
{ {
Console.WriteLine($"{DateTime.Now:HH:mm:ss}: Could not find the specified end time slot: {endTime}"); 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" });
await page.CloseAsync();
return; return;
} }
@@ -118,10 +120,16 @@ var bmlOtp = await GoogleMessages.GetBMLOTP(context, page);
if (bmlOtp is not null) if (bmlOtp is not null)
Console.WriteLine($"Extracted BML OTP: {bmlOtp}"); Console.WriteLine($"Extracted BML OTP: {bmlOtp}");
else else
{
await page.CloseAsync();
return; return;
}
await page.Locator("input[name='otpValue']").FillAsync(bmlOtp); await page.Locator("input[name='otpValue']").FillAsync(bmlOtp);
await page.GetByRole(AriaRole.Button, new() { Name = "CONFIRM" }).ClickAsync(); await page.GetByRole(AriaRole.Button, new() { Name = "CONFIRM" }).ClickAsync();
await Task.Delay(15000); await Task.Delay(15000);
var hdcMessage = await GoogleMessages.GetMessageFromHDC(context, page); var hdcMessage = await GoogleMessages.GetMessageFromHDC(context, page);
Console.WriteLine($"Message from HDC: {hdcMessage}"); Console.WriteLine($"Message from HDC: {hdcMessage}");
await page.CloseAsync();
+2
View File
@@ -9,3 +9,5 @@ In the future perhaps it would be much better if I can deploy as a webapp that c
Where `22:00` is the end time of the prefered time. `22:00` is the slot from `21:00 - 22:00`. Where `22:00` is the end time of the prefered time. `22:00` is the slot from `21:00 - 22:00`.
Preferably the application will be run close to 8AM around 7:45AM so that there's need to perpetually keep refreshing the site for a long time. Preferably the application will be run close to 8AM around 7:45AM so that there's need to perpetually keep refreshing the site for a long time.
**``OWO``**