当前位置: 首页>>代码示例>>Java>>正文


Java WrapsElement类代码示例

本文整理汇总了Java中org.openqa.selenium.internal.WrapsElement的典型用法代码示例。如果您正苦于以下问题:Java WrapsElement类的具体用法?Java WrapsElement怎么用?Java WrapsElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WrapsElement类属于org.openqa.selenium.internal包,在下文中一共展示了WrapsElement类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stalenessOf

import org.openqa.selenium.internal.WrapsElement; //导入依赖的package包/类
/**
 * 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);
            }
        }

        @Override
        public Boolean apply(SearchContext ignored) {
            return condition.apply(null);
        }

        @Override
        public String toString() {
            return condition.toString();
        }
    };
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:31,代码来源:Coordinators.java

示例2: unpackWebDriverFromSearchContext

import org.openqa.selenium.internal.WrapsElement; //导入依赖的package包/类
/**
 * This method extract an instance of {@link org.openqa.selenium.WebDriver} from the given
 * {@link org.openqa.selenium.SearchContext}.
 * @param searchContext is an instance of {@link org.openqa.selenium.SearchContext}
 *                It may be the instance of {@link org.openqa.selenium.WebDriver}
 *                or {@link org.openqa.selenium.WebElement} or some other user's
 *                extension/implementation.
 *                Note: if you want to use your own implementation then it should implement
 *                {@link org.openqa.selenium.internal.WrapsDriver} or
 *                      {@link org.openqa.selenium.internal.WrapsElement}
 * @return the instance of {@link org.openqa.selenium.WebDriver}.
 *         Note: if the given {@link org.openqa.selenium.SearchContext} is not
 *         {@link org.openqa.selenium.WebDriver} and it doesn't implement
 *         {@link org.openqa.selenium.internal.WrapsDriver} or
 *         {@link org.openqa.selenium.internal.WrapsElement} then this method returns
 *         null.
 *
 */
public static WebDriver unpackWebDriverFromSearchContext(SearchContext searchContext) {
    if (searchContext instanceof WebDriver) {
        return (WebDriver) searchContext;
    }

    if (searchContext instanceof WrapsDriver) {
        return unpackWebDriverFromSearchContext(
                ((WrapsDriver) searchContext).getWrappedDriver());
    }

    // Search context it is not only Webdriver. Webelement is search context
    // too.
    // RemoteWebElement and MobileElement implement WrapsDriver
    if (searchContext instanceof WrapsElement) {
        return unpackWebDriverFromSearchContext(
                ((WrapsElement) searchContext).getWrappedElement());
    }

    return null;
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:39,代码来源:WebDriverUnpackUtility.java

示例3: call

import org.openqa.selenium.internal.WrapsElement; //导入依赖的package包/类
@Override
public Boolean call() throws Exception {

  WebElement one = getElement();
  WebElement two = getKnownElements().get(otherId);

  // Unwrap the elements, if necessary
  if (one instanceof WrapsElement) {
    one = ((WrapsElement) one).getWrappedElement();
  }
  if (two instanceof KnownElements.ProxiedElement) {
    two = ((KnownElements.ProxiedElement) two).getWrappedElement();
  }

  return one.equals(two);
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:17,代码来源:ElementEquality.java

示例4: apply

import org.openqa.selenium.internal.WrapsElement; //导入依赖的package包/类
@Override
public WebElement apply(final WebElement element) {
    return (WebElement) newProxyInstance(
            getClass().getClassLoader(),
            new Class[]{WebElement.class, WrapsElement.class, Locatable.class, HasIdentity.class},
            invocationHandlerFor(element)
    );
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:9,代码来源:FrameAwareWebElementTransformer.java

示例5: testGetWrappedElementOfTransformedElement

import org.openqa.selenium.internal.WrapsElement; //导入依赖的package包/类
@Test(enabled = false)
public void testGetWrappedElementOfTransformedElement() {
    final WebElement element = givenElement();
    final WebElement transformedElement = transformer.apply(element);

    assertThat(((WrapsElement) transformedElement).getWrappedElement(), sameInstance(element));
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:8,代码来源:FrameAwareWebElementTransformerTest.java

示例6: proxyForLocator

import org.openqa.selenium.internal.WrapsElement; //导入依赖的package包/类
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) ? new LocalizedAnnotations(field).buildBy() : null, webDriver);
}
 
开发者ID:qaprosoft,项目名称:carina,代码行数:8,代码来源:ExtendedFieldDecorator.java

示例7: extractInterfaces

import org.openqa.selenium.internal.WrapsElement; //导入依赖的package包/类
protected Class<?>[] extractInterfaces(Object object) {
	Set<Class<?>> allInterfaces = new HashSet<Class<?>>();
	allInterfaces.add(WrapsDriver.class);
	if (object instanceof WebElement) {
		allInterfaces.add(WrapsElement.class);
	}
	extractInterfaces(allInterfaces, object.getClass());

	return allInterfaces.toArray(new Class<?>[allInterfaces.size()]);
}
 
开发者ID:vorburger,项目名称:webdriver-runner,代码行数:11,代码来源:DelegatingWebDriver.java

示例8: getWebElementFromFactory

import org.openqa.selenium.internal.WrapsElement; //导入依赖的package包/类
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);
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:7,代码来源:CurrentWebElementProvider.java


注:本文中的org.openqa.selenium.internal.WrapsElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。