if (webdriver instanceof TakesScreenshot) {
targetFile = takeScreenshotImage((TakesScreenshot) webdriver, fileName, targetFile);
}
else if (webdriver instanceof RemoteWebDriver) {
WebDriver remoteDriver = new Augmenter().augment(webdriver);
if (webdriver instanceof TakesScreenshot) {
targetFile = takeScreenshotImage((TakesScreenshot) remoteDriver, fileName, targetFile);
}
}