Reverted concurrent popup lookup
All checks were successful
Push image to registry / build-image (push) Successful in 3m6s
All checks were successful
Push image to registry / build-image (push) Successful in 3m6s
This commit is contained in:
@@ -10,7 +10,6 @@ use App\Notification\Providers\AllNotification;
|
|||||||
use Facebook\WebDriver\WebDriverBy;
|
use Facebook\WebDriver\WebDriverBy;
|
||||||
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Concurrency;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Laravel\Dusk\Browser;
|
use Laravel\Dusk\Browser;
|
||||||
use App\Services\AIPrompt\OpenAPIPrompt;
|
use App\Services\AIPrompt\OpenAPIPrompt;
|
||||||
@@ -108,22 +107,9 @@ abstract class InstagramAbstractJob extends BrowserJob implements ShouldBeUnique
|
|||||||
['//button|//div[contains(text(), "OK")]', ["Popup Ok clicked"]], // OK
|
['//button|//div[contains(text(), "OK")]', ["Popup Ok clicked"]], // OK
|
||||||
];
|
];
|
||||||
|
|
||||||
$fn = [];
|
|
||||||
foreach ($popupsTypes as $popup) {
|
foreach ($popupsTypes as $popup) {
|
||||||
$fn[] = function () use ($browser, $popup) {
|
|
||||||
try {
|
|
||||||
return $browser->driver->findElement(WebDriverBy::xpath($popup[0]));
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$buttons = Concurrency::run($fn);
|
|
||||||
|
|
||||||
foreach ($popupsTypes as $index => $popup) {
|
|
||||||
try {
|
try {
|
||||||
$button = $buttons[$index] ?? null;
|
$button = $browser->driver->findElement(WebDriverBy::xpath($popup[0]));
|
||||||
if ($button === null) {
|
if ($button === null) {
|
||||||
continue; // No button found, continue to the next popup
|
continue; // No button found, continue to the next popup
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user