Skip to content

Instantly share code, notes, and snippets.

@kporras07
Last active January 21, 2016 21:06
Show Gist options
  • Save kporras07/c7e70927d855ea027771 to your computer and use it in GitHub Desktop.
Save kporras07/c7e70927d855ea027771 to your computer and use it in GitHub Desktop.
Screenshot with behat selenium
<?php
/**
* This works for Selenium and other real browsers that support screenshots.
*
* @Then /^show me an screenshot$/
*/
public function showMeAnScreenshot() {
$image_data = $this->getSession()->getDriver()->getScreenshot();
$file_and_path = '/tmp/behat_screenshot.png';
file_put_contents($file_and_path, $image_data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment