@Override
  public void runner() throws Exception {
    try {
      initDriver();
      String sUrl;
      if (credentialItem != null) {
        sUrl =
            new URI(
                    url.getProtocol(),
                    credentialItem.getURLUserInfo(),
                    url.getHost(),
                    url.getPort(),
                    url.getPath(),
                    url.getQuery(),
                    url.getRef())
                .toString();
      } else sUrl = url.toExternalForm();
      browserDriver.get(sUrl);
      if (waitSec > 0) sleepSec(waitSec);
      BufferedImage image = browserDriver.getScreenshot();
      if (visiblePartOnly)
        image = ImageUtils.getSubimage(image, 0, 0, capture.width, capture.height);

      if (resize != null) image = ImageUtils.reduceImage(image, resize.width, resize.height);
      if (reductionPercent < 100) image = ImageUtils.reduceImage(image, reductionPercent);
      if (screenshotManager != null) screenshotManager.store(url, image);
      finalImage = image;
    } finally {
      release();
    }
  }
 private final void initDriver() throws SearchLibException {
   lock.rl.lock();
   try {
     browserDriver = browserDriverEnum.getNewInstance();
     browserDriver.setTimeouts(60, 60);
     browserDriver.setSize(capture.width, capture.height);
   } catch (InstantiationException e) {
     throw new SearchLibException(e);
   } catch (IllegalAccessException e) {
     throw new SearchLibException(e);
   } finally {
     lock.rl.unlock();
   }
 }
 @Override
 public void release() {
   lock.rl.lock();
   try {
     if (browserDriver == null) return;
     browserDriver.close();
   } catch (IOException e) {
     Logging.warn(e);
   } finally {
     lock.rl.unlock();
   }
 }