Skip to content

Commit

Permalink
Merge pull request #26 from pamil/webdriver-exception
Browse files Browse the repository at this point in the history
Mute WebDriver's Exceptions
  • Loading branch information
pamil committed Oct 27, 2016
2 parents 6ee06ae + ba11f12 commit fb04a47
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Listener/FailedStepListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Behat\Mink\Session;
use Behat\Testwork\Tester\Result\TestResult;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use WebDriver\Exception as WebDriverException;

/**
* @author Kamil Kokot <kamil.kokot@lakion.com>
Expand Down Expand Up @@ -111,7 +112,9 @@ private function logScreenshot()
return;
}

$this->saveLog($session->getScreenshot(), 'png');
try {
$this->saveLog($session->getScreenshot(), 'png');
} catch (WebDriverException $exception) {}
}

/**
Expand Down Expand Up @@ -160,6 +163,8 @@ private function getStatusCode(Session $session)
return $session->getStatusCode();
} catch (MinkException $exception) {
return null;
} catch (WebDriverException $exception) {
return null;
}
}

Expand All @@ -174,6 +179,8 @@ private function getCurrentUrl(Session $session)
return $session->getCurrentUrl();
} catch (MinkException $exception) {
return null;
} catch (WebDriverException $exception) {
return null;
}
}

Expand All @@ -188,6 +195,8 @@ private function getResponseHeadersLogMessage(Session $session)
return 'Response headers:' . "\n" . print_r($session->getResponseHeaders(), true) . "\n";
} catch (MinkException $exception) {
return null;
} catch (WebDriverException $exception) {
return null;
}
}

Expand All @@ -202,6 +211,8 @@ private function getResponseContentLogMessage(Session $session)
return 'Response content:' . "\n" . $session->getPage()->getContent() . "\n";
} catch (MinkException $exception) {
return null;
} catch (WebDriverException $exception) {
return null;
}
}
}

0 comments on commit fb04a47

Please sign in to comment.