From 599ef77d648535a1e6356c3b14401f6585b6fc77 Mon Sep 17 00:00:00 2001 From: Matthias Guillitte Date: Sun, 2 Mar 2025 09:08:44 +0100 Subject: [PATCH] Should fix steam connexion --- app/Browser/Jobs/Hellcase/HellcaseJob.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Browser/Jobs/Hellcase/HellcaseJob.php b/app/Browser/Jobs/Hellcase/HellcaseJob.php index 7650bbc..6b43b02 100644 --- a/app/Browser/Jobs/Hellcase/HellcaseJob.php +++ b/app/Browser/Jobs/Hellcase/HellcaseJob.php @@ -11,6 +11,7 @@ use App\Notification\NotificationBody\Hellcase\HellcaseNotificationDailyFreeBody use App\Notification\NotificationBody\Hellcase\HellcaseNotificationLoginBody; use App\Notification\Notifications\Hellcase\HellcaseNotificationDailyFree; use App\Notification\Notifications\Hellcase\HellcaseNotificationLogin; +use App\Notification\Notifications\JobErrorNotification; use App\Notification\Providers\AllNotification; use Facebook\WebDriver\WebDriverBy; use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing; @@ -97,7 +98,13 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing // QR CODE SCANNING try { $browser->waitForTextIn("div", "Or sign in with QR", 30, true); - $qrCode = $browser->driver->findElement(WebDriverBy::xpath('//div[./*[contains(text(), "Or sign in with QR")]]')); + sleep(10); + try { + $qrCode = $browser->driver->findElement(WebDriverBy::xpath('//div[./*[contains(text(), "Or sign in with QR")]]')); + } catch (\Exception $e) { + AllNotification::send(new JobErrorNotification($this->jobId, "Le QR code de la page de connexion de Steam n'a pas été trouvé")); + throw $e; + } // Wait to be redirected to the Steam login page, while waiting take a new screenshot every 30 seconds $isBackOnHellcase = false; @@ -122,9 +129,11 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing } } catch (\Exception $e) { // If the QR code is not found, we are not on the QR code page + Log::debug("Exception because qrcode not found : " . $e); $isBackOnHellcase = true; } catch (\Throwable $e) { // If the QR code is not found, we are not on the QR code page + Log::debug("Exception because qrcode not found : " . $e); $isBackOnHellcase = true; }