Java 类org.openqa.selenium.remote.Augmentable 实例源码

项目:carina    文件:DriverAugmenter.java   
@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;
    }
}
项目:cinnamon    文件:Screenshot.java   
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() + "].");
    }
}