类org.openqa.selenium.internal.WrapsElement源码实例Demo

下面列出了怎么用org.openqa.selenium.internal.WrapsElement的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: teasy   文件: FrameAwareWebElementTransformer.java
@Override
public WebElement apply(final WebElement element) {
    return (WebElement) newProxyInstance(
            getClass().getClassLoader(),
            new Class[]{WebElement.class, WrapsElement.class, Locatable.class, HasIdentity.class},
            invocationHandlerFor(element)
    );
}
 
源代码2 项目: Selenium-Foundation   文件: Coordinators.java
/**
 * Returns a 'wait' proxy that determines if the specified element reference has gone stale.
 *
 * @param element the element to wait for
 * @return 'false' if the element reference is still valid; otherwise 'true'
 */
public static Coordinator<Boolean> stalenessOf(final WebElement element) {
    return new Coordinator<Boolean>() {
        private final ExpectedCondition<Boolean> condition = conditionInitializer();

        // initializer for [condition] field
        private final ExpectedCondition<Boolean> conditionInitializer() {
            if (element instanceof WrapsElement) {
                return ExpectedConditions.stalenessOf(((WrapsElement) element).getWrappedElement());
            } else {
                return ExpectedConditions.stalenessOf(element);
            }
        }
        
        /**
         * {@inheritDoc}
         */
        @Override
        public Boolean apply(final SearchContext ignored) {
            return condition.apply(null);
        }
        
        /**
         * {@inheritDoc}
         */
        @Override
        public String toString() {
            return condition.toString();
        }
        
        /**
         * {@inheritDoc}
         */
        @Override
        public TimeoutException differentiateTimeout(TimeoutException e) {
            return new ElementStillFreshTimeoutException(e.getMessage(), e.getCause());
        }
    };
}
 
源代码3 项目: flow   文件: TestBenchHelpers.java
/**
 * Assert that the two elements are equal.
 * <p>
 * Can be removed if https://dev.vaadin.com/ticket/18484 is fixed.
 *
 * @param expectedElement
 *            the expected element
 * @param actualElement
 *            the actual element
 */
protected static void assertEquals(WebElement expectedElement,
        WebElement actualElement) {
    WebElement unwrappedExpected = expectedElement;
    WebElement unwrappedActual = actualElement;
    while (unwrappedExpected instanceof WrapsElement) {
        unwrappedExpected = ((WrapsElement) unwrappedExpected)
                .getWrappedElement();
    }
    while (unwrappedActual instanceof WrapsElement) {
        unwrappedActual = ((WrapsElement) unwrappedActual)
                .getWrappedElement();
    }
    Assert.assertEquals(unwrappedExpected, unwrappedActual);
}
 
源代码4 项目: carina   文件: ExtendedFieldDecorator.java
protected ExtendedWebElement proxyForLocator(ClassLoader loader, Field field, ElementLocator locator) {
    InvocationHandler handler = new LocatingElementHandler(locator);
    WebElement proxy = (WebElement) Proxy.newProxyInstance(loader, new Class[] { WebElement.class, WrapsElement.class, Locatable.class },
            handler);
    return new ExtendedWebElement(proxy, field.getName(),
            field.isAnnotationPresent(FindBy.class) || field.isAnnotationPresent(ExtendedFindBy.class)? new LocalizedAnnotations(field).buildBy() : null);
}
 
源代码5 项目: healenium-web   文件: ProxyFactory.java
public static <T extends WebElement> T createWebElementProxy(ClassLoader loader, InvocationHandler handler) {
    Class<?>[] interfaces = new Class[]{WebElement.class, WrapsElement.class, Locatable.class};
    return (T) Proxy.newProxyInstance(loader, interfaces, handler);
}
 
源代码6 项目: bobcat   文件: CurrentWebElementProvider.java
private WebElement getWebElementFromFactory(ElementLocatorFactory factory) {
  InvocationHandler handler = new LocatingElementHandler(
      ((ParentElementLocatorProvider) factory).getCurrentScope());
  return (WebElement) Proxy.newProxyInstance(WebElement.class.getClassLoader(),
      new Class[] {WebElement.class, WrapsElement.class, Locatable.class}, handler);
}
 
 类所在包
 同包方法