Click the next button
All checks were successful
Push image to registry / build-image (push) Successful in 8m26s

This commit is contained in:
2025-03-11 19:33:44 +01:00
parent a693339f97
commit 8e356ac1ef

View File

@ -159,6 +159,8 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
try { try {
$buttons = $browser->driver->findElements(WebDriverBy::xpath('//a[text() = "Join for free"]')); $buttons = $browser->driver->findElements(WebDriverBy::xpath('//a[text() = "Join for free"]'));
} catch (\Exception $e) { } catch (\Exception $e) {
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
AllNotification::send(new JobDebugNotification($this->jobId, "No join for free buttons found"));
return; return;
} }
@ -169,15 +171,26 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
])); ]));
} }
foreach ($buttons as $button) { foreach ($buttons as $button) {
$clicked = false; try {
while (!$clicked) { $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;
}
$clickedFailsCounter = 0;
while ($clickedFailsCounter < 7 && $clickedFailsCounter > 0) {
try { try {
$button->click(); $button->click();
} catch (\Exception $e) { } catch (\Exception $e) {
$clickedFailsCounter++;
try {
$nextSlideButton->click();
} catch (\Exception $_) {}
sleep(3);
continue; continue;
} }
$clicked = true; $clickedFailsCounter = -1;
sleep(3);
} }
sleep(5); sleep(5);
$this->joinGiveaway($browser); $this->joinGiveaway($browser);