Fix joining giveaways

This commit is contained in:
2025-03-15 16:26:29 +01:00
parent 63216ae7e8
commit ad10dcaa0f

View File

@ -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();