/** * @param null|string $save_as * @return string * @throws WebDriverException */ public function takeScreenshot($save_as = null) { try { return $this->driver->takeScreenshot($save_as); } catch (WebDriverException $exception) { $this->dispatchOnException($exception); } }
public function screenshot(WebDriver $webDriver, $case = 'undefined') { $this->_createScreenShotDirIfNotExists(); $screenName = date('d|m|y|H|i|s') . '|' . $case . '.png'; file_put_contents($this->screenshotDir . DIRECTORY_SEPARATOR . $screenName, $webDriver->takeScreenshot()); $buildNumber = $this->suiteSettings->getBuildNumber(); $buildNumberPath = $buildNumber !== '' ? $buildNumber . DIRECTORY_SEPARATOR : ''; $loggingDirectoryName = $this->suiteSettings->getLoggingDirectoryName(); $loggingDirectoryNamePath = $loggingDirectoryName !== '' ? $loggingDirectoryName . DIRECTORY_SEPARATOR : ''; return rtrim($buildNumberPath . $loggingDirectoryNamePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'screenshots' . DIRECTORY_SEPARATOR . $screenName; }
/** * @param string $path */ public function takeScreenshot($path) { $this->_webDriver->takeScreenshot($path); }
public function screenshot($name) { $this->driver->takeScreenshot($this->screenshot_folder . DIRECTORY_SEPARATOR . $name . '.png'); }