public class InternetExplorerDriver extends RemoteWebDriver implements TakesScreenshot {
public InternetExplorerDriver(InternetExplorerDriverService service, Capabilities capabilities) {
assertOnWindows();
setCommandExecutor(new DriverCommandExecutor(service));
startSession(capabilities);
}
public <X> X getScreenshotAs(OutputType<X> target) {
// Get the screenshot as base64.
String base64 = execute(DriverCommand.SCREENSHOT).getValue().toString();
// ... and convert it.
return target.convertFromBase64Png(base64);
}
private void setupService(int port) {
try {
InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
.usingPort(port).build();
setCommandExecutor(new DriverCommandExecutor(service));