diff --git a/app/Browser/Jobs/Hellcase/HellcaseJob.php b/app/Browser/Jobs/Hellcase/HellcaseJob.php index 44fd93e..3772e9c 100644 --- a/app/Browser/Jobs/Hellcase/HellcaseJob.php +++ b/app/Browser/Jobs/Hellcase/HellcaseJob.php @@ -52,7 +52,7 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing } catch (\Exception $e) { $this->jobRun->success = false; $this->jobRun->save(); - AllNotification::send(new JobErrorNotification($this->jobId, "Erreur lors de la participation aux concours gratuits", $e->getMessage())); + AllNotification::send(new JobErrorNotification($this->jobId, "Erreur lors de la participation aux concours gratuits : " . $e->getMessage())); } $this->getDailyFree($browser); @@ -170,16 +170,17 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing "content" => "" ])); } + try { + $nextSlideButton = $browser->driver->findElement(WebDriverBy::xpath('//button[@class="_button_1ygbm_7 _next_1ygbm_24"]')); + } catch (\Exception $e) { + $browser->screenshot(JobDebugScreenshot::getFileName($this->jobId)); + AllNotification::send(new JobDebugNotification($this->jobId, "No next slide button found")); + return; + } foreach ($buttons as $button) { - try { - $nextSlideButton = $browser->driver->findElement(WebDriverBy::xpath('//button[@class="_button_1ygbm_7 _next_1ygbm_24"]')); - } catch (\Exception $e) { - $browser->screenshot(JobDebugScreenshot::getFileName($this->jobId)); - AllNotification::send(new JobDebugNotification($this->jobId, "No next slide button found")); - return; - } + // Click the next slide button if the button is not clickable $clickedFailsCounter = 0; - while ($clickedFailsCounter < 7 && $clickedFailsCounter > 0) { + while ($clickedFailsCounter < 7 && $clickedFailsCounter >= 0) { try { $button->click(); } catch (\Exception $e) { @@ -192,7 +193,8 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing } $clickedFailsCounter = -1; } - sleep(5); + + sleep(5); // Wait a bit for loading $this->joinGiveaway($browser); $browser->within(new MainNav, function (Browser $browser) { $browser->goToHome();