Fix signin skip
This commit is contained in:
@@ -53,8 +53,12 @@ abstract class InstagramAbstractJob extends BrowserJob implements ShouldBeUnique
|
|||||||
|
|
||||||
protected function signin(Browser $browser)
|
protected function signin(Browser $browser)
|
||||||
{
|
{
|
||||||
if ($browser->assertSee("Search", true)) {
|
// Verify if already signed in so we can skip
|
||||||
return; // Already signed in, skip some waiting for non existing text
|
try {
|
||||||
|
$browser->waitForText("Search", 1);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::debug("Not already signed in, continue with the signin process");
|
||||||
|
// Not already signed in, continue with the signin process
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -75,6 +79,18 @@ abstract class InstagramAbstractJob extends BrowserJob implements ShouldBeUnique
|
|||||||
$browser->waitForText("Search", 15, true);
|
$browser->waitForText("Search", 15, true);
|
||||||
$this->removePopups($browser);
|
$this->removePopups($browser);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
// Incorrect password
|
||||||
|
try {
|
||||||
|
$browser->waitForText("Sorry, your password was incorrect. Please double-check your password.", 1, true);
|
||||||
|
Log::error("Instagram login failed: Incorrect password.");
|
||||||
|
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||||
|
AllNotification::send(new JobDebugNotification($this->jobId, "Instagram login failed: Incorrect password."));
|
||||||
|
// Stop the job run
|
||||||
|
throw new \Exception("Instagram login failed: Incorrect password.");
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Not the expected error, continue
|
||||||
|
}
|
||||||
|
|
||||||
Log::error("Failed to sign in: " . $e->getMessage());
|
Log::error("Failed to sign in: " . $e->getMessage());
|
||||||
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||||
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to sign in: " . $e->getMessage()));
|
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to sign in: " . $e->getMessage()));
|
||||||
|
Reference in New Issue
Block a user