You are here

public function PageContentTrait::getScreenshot in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/jcalderonzumba/mink-phantomjs-driver/src/PageContentTrait.php \Zumba\Mink\Driver\PageContentTrait::getScreenshot()

Returns the binary representation of the current page we are in

Return value

string

Throws

DriverException

File

vendor/jcalderonzumba/mink-phantomjs-driver/src/PageContentTrait.php, line 64

Class

PageContentTrait
Class PageContentTrait @package Zumba\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

public function getScreenshot() {
  $options = array(
    "full" => true,
    "selector" => null,
  );
  $b64ScreenShot = $this->browser
    ->renderBase64("JPEG", $options);
  if (($binaryScreenShot = base64_decode($b64ScreenShot, true)) === false) {
    throw new DriverException("There was a problem while doing the screenshot of the current page");
  }
  return $binaryScreenShot;
}