Example #1
0
 public function _saveScreenshot($filename)
 {
     if (!$this->webDriverSession) {
         $this->debug("Can't make screenshot, no web driver");
         return;
     }
     $imgData = base64_decode($this->webDriverSession->screenshot());
     file_put_contents($filename, $imgData);
 }
Example #2
0
 /**
  * Capture a screenshot of the current window.
  *
  * @return  string  screenshot of MIME type image/* depending
  *   on driver (e.g., image/png, image/jpeg)
  */
 public function getScreenshot()
 {
     return base64_decode($this->wdSession->screenshot());
 }
Example #3
0
 /**
  * Take a snapshot of the current page.
  *
  * @param  string|null $destination
  * @return static
  */
 public function snap($destination = null)
 {
     $destination = $destination ?: './tests/logs/screenshot.png';
     $this->files()->put($destination, base64_decode($this->session->screenshot()));
     return $this;
 }