/**
  * @param  string                   $filename Snapshot filename. Should be unique per test
  * @param  string                   $logDir   Directory to write snapshots into
  * @param  UriInterface|string|null $base     Resolve all relative links with this base uri
  */
 public function saveSessionSnapshot($filename, $logDir, $base = null)
 {
     if (is_dir($logDir) && is_writable($logDir)) {
         if ($this->currentSession instanceof CrawlerSession) {
             $this->currentSession->saveHtml("{$logDir}/{$filename}.html", $base);
         }
         if ($this->currentSession instanceof BrowserSession) {
             $this->currentSession->saveScreenshot("{$logDir}/{$filename}.png");
         }
     } else {
         throw new InvalidArgumentException(sprintf('Make sure directory %s exists and is writable', $logDir));
     }
 }