-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from pamil/webdriver-exception
Mute WebDriver's Exceptions
- Loading branch information
Showing
1 changed file
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
|
@@ -111,7 +112,9 @@ private function logScreenshot() | |
return; | ||
} | ||
|
||
$this->saveLog($session->getScreenshot(), 'png'); | ||
try { | ||
$this->saveLog($session->getScreenshot(), 'png'); | ||
} catch (WebDriverException $exception) {} | ||
} | ||
|
||
/** | ||
|
@@ -160,6 +163,8 @@ private function getStatusCode(Session $session) | |
return $session->getStatusCode(); | ||
} catch (MinkException $exception) { | ||
return null; | ||
} catch (WebDriverException $exception) { | ||
return null; | ||
} | ||
} | ||
|
||
|
@@ -174,6 +179,8 @@ private function getCurrentUrl(Session $session) | |
return $session->getCurrentUrl(); | ||
} catch (MinkException $exception) { | ||
return null; | ||
} catch (WebDriverException $exception) { | ||
return null; | ||
} | ||
} | ||
|
||
|
@@ -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; | ||
} | ||
} | ||
|
||
|
@@ -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; | ||
} | ||
} | ||
} |