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); }
/** * 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()); }
/** * 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; }