Created
December 11, 2016 17:13
-
-
Save fadonascimento/39d338c011ebf2911dc12ca5d6b94530 to your computer and use it in GitHub Desktop.
Take screenshot with behat
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
use Behat\Mink\Driver\Selenium2Driver; | |
use Behat\Behat\Hook\Scope\AfterStepScope; | |
/** | |
* @When /^I take a screnshoot "([^"]*)"$/ | |
*/ | |
public function takeScreenShotAfterFailedStep($filePath) | |
{ | |
$driver = $this->getSession()->getDriver(); | |
if (!($driver instanceof Selenium2Driver)) { | |
return; | |
} | |
file_put_contents($filePath, $this->getSession()->getDriver()->getScreenshot()); | |
} | |
I take a screnshoot "path/filename.png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment