com.applitools.eyes.TakesScreenshotImageProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eyes-selenium-java-jersey1_17-sf2_53_1 Show documentation
Show all versions of eyes-selenium-java-jersey1_17-sf2_53_1 Show documentation
Applitools Eyes SDK for Selenium Java WebDriver
The newest version!
package com.applitools.eyes;
import com.applitools.utils.ImageUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import java.awt.image.BufferedImage;
/**
* An image provider based on WebDriver's {@link TakesScreenshot} interface.
*/
class TakesScreenshotImageProvider implements ImageProvider {
private final Logger logger;
private final TakesScreenshot tsInstance;
public TakesScreenshotImageProvider(Logger logger, TakesScreenshot
tsInstance) {
this.logger = logger;
this.tsInstance = tsInstance;
}
public BufferedImage getImage() {
logger.verbose("Getting screenshot as base64...");
String screenshot64 = tsInstance.getScreenshotAs(OutputType.BASE64);
logger.verbose("Done getting base64! Creating BufferedImage..");
return ImageUtils.imageFromBase64(screenshot64);
}
}