@Override protected RemoteWebDriver extractRemoteWebDriver(WebDriver driver) { if (driver.getClass().isAnnotationPresent(Augmentable.class) || driver .getClass() .getName() .startsWith( "org.openqa.selenium.remote.RemoteWebDriver$$EnhancerByCGLIB") || driver .getClass() .getName() .startsWith( "com.qaprosoft.carina.core.foundation.webdriver")) { return (RemoteWebDriver) driver; } else { return null; } }
public <T> T getScreenshotAs(OutputType<T> target) throws WebDriverException { try { TakesScreenshot takesScreenshot = webDriver.getClass().isAnnotationPresent(Augmentable.class) ? (TakesScreenshot) new Augmenter().augment(webDriver) : (TakesScreenshot) webDriver; return takesScreenshot.getScreenshotAs(target); } catch (ClassCastException e) { throw new WebDriverException( "Taking screenshots is not supported by the concrete implementation of WebDriver [" + webDriver.getClass() + "]."); } }