Created
December 8, 2015 17:38
-
-
Save jhedstrom/38be8a6e263947d7e7c0 to your computer and use it in GitHub Desktop.
Behat Selenium driver screenshot
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
<?php | |
/** | |
* @AfterStep | |
*/ | |
public function takeScreenShotAfterFailedStep(AfterStepScope $scope) { | |
if (99 === $scope->getTestResult()->getResultCode()) { | |
$driver = $this->getSession()->getDriver(); | |
if (!($driver instanceof Selenium2Driver)) { | |
return; | |
} | |
file_put_contents('/path/to/screenshots/filename.png', $this->getSession()->getDriver()->getScreenshot()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment