org.openqa.selenium.SearchContext#getClass ( )源码实例Demo

下面列出了org.openqa.selenium.SearchContext#getClass ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override
public List<WebElement> findElements(SearchContext context) throws WebDriverException,
    IllegalArgumentException {
    Class<?> contextClass = context.getClass();

    if (FindsByAndroidUIAutomator.class.isAssignableFrom(contextClass)) {
        return FindsByAndroidUIAutomator.class.cast(context)
            .findElementsByAndroidUIAutomator(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAndroidUIAutomator.class,
        FindsByFluentSelector.class);
}
 
源代码2 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) throws WebDriverException,
    IllegalArgumentException {
    Class<?> contextClass = context.getClass();

    if (FindsByAndroidUIAutomator.class.isAssignableFrom(contextClass)) {
        return FindsByAndroidUIAutomator.class.cast(context)
            .findElementByAndroidUIAutomator(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAndroidUIAutomator.class,
        FindsByFluentSelector.class);
}
 
源代码3 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override
public List<WebElement> findElements(SearchContext context) throws WebDriverException,
    IllegalArgumentException {
    Class<?> contextClass = context.getClass();

    if (FindsByAccessibilityId.class.isAssignableFrom(contextClass)) {
        return FindsByAccessibilityId.class.cast(context)
            .findElementsByAccessibilityId(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAccessibilityId.class,
        FindsByFluentSelector.class);
}
 
源代码4 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) throws WebDriverException,
    IllegalArgumentException {
    Class<?> contextClass = context.getClass();

    if (FindsByAccessibilityId.class.isAssignableFrom(contextClass)) {
        return FindsByAccessibilityId.class.cast(context)
            .findElementByAccessibilityId(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAccessibilityId.class,
        FindsByFluentSelector.class);
}
 
源代码5 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByIosClassChain.class.isAssignableFrom(contextClass)) {
        return FindsByIosClassChain.class.cast(context)
                .findElementsByIosClassChain(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByIosClassChain.class,
            FindsByFluentSelector.class);
}
 
源代码6 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByIosClassChain.class.isAssignableFrom(contextClass)) {
        return FindsByIosClassChain.class.cast(context)
                .findElementByIosClassChain(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByIosClassChain.class,
            FindsByFluentSelector.class);
}
 
源代码7 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByAndroidDataMatcher.class.isAssignableFrom(contextClass)) {
        return FindsByAndroidDataMatcher.class.cast(context)
                .findElementsByAndroidDataMatcher(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAndroidDataMatcher.class,
            FindsByFluentSelector.class);
}
 
源代码8 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByAndroidDataMatcher.class.isAssignableFrom(contextClass)) {
        return FindsByAndroidDataMatcher.class.cast(context)
                .findElementByAndroidDataMatcher(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAndroidDataMatcher.class,
            FindsByFluentSelector.class);
}
 
源代码9 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByAndroidViewMatcher.class.isAssignableFrom(contextClass)) {
        return FindsByAndroidViewMatcher.class.cast(context)
            .findElementsByAndroidViewMatcher(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAndroidViewMatcher.class,
        FindsByFluentSelector.class);
}
 
源代码10 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByAndroidViewMatcher.class.isAssignableFrom(contextClass)) {
        return FindsByAndroidViewMatcher.class.cast(context)
            .findElementByAndroidViewMatcher(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAndroidViewMatcher.class,
        FindsByFluentSelector.class);
}
 
源代码11 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByIosNSPredicate.class.isAssignableFrom(contextClass)) {
        return FindsByIosNSPredicate.class.cast(context)
                .findElementsByIosNsPredicate(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByIosNSPredicate.class,
            FindsByFluentSelector.class);
}
 
源代码12 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByIosNSPredicate.class.isAssignableFrom(contextClass)) {
        return FindsByIosNSPredicate.class.cast(context)
                .findElementByIosNsPredicate(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByIosNSPredicate.class,
            FindsByFluentSelector.class);
}
 
源代码13 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByWindowsAutomation.class.isAssignableFrom(contextClass)) {
        return FindsByWindowsAutomation.class.cast(context)
            .findElementsByWindowsUIAutomation(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByWindowsAutomation.class,
        FindsByFluentSelector.class);
}
 
源代码14 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByWindowsAutomation.class.isAssignableFrom(contextClass)) {
        return FindsByWindowsAutomation.class.cast(context)
            .findElementByWindowsUIAutomation(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByIosNSPredicate.class,
        FindsByWindowsAutomation.class);
}
 
源代码15 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override
public List<WebElement> findElements(SearchContext context) throws WebDriverException,
        IllegalArgumentException {
    Class<?> contextClass = context.getClass();

    if (FindsByAndroidViewTag.class.isAssignableFrom(contextClass)) {
        return FindsByAndroidViewTag.class.cast(context)
                .findElementsByAndroidViewTag(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAndroidViewTag.class,
            FindsByFluentSelector.class);
}
 
源代码16 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) throws WebDriverException,
        IllegalArgumentException {
    Class<?> contextClass = context.getClass();

    if (FindsByAndroidViewTag.class.isAssignableFrom(contextClass)) {
        return FindsByAndroidViewTag.class.cast(context)
                .findElementByAndroidViewTag(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByAndroidViewTag.class,
            FindsByFluentSelector.class);
}
 
源代码17 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByImage.class.isAssignableFrom(contextClass)) {
        return FindsByImage.class.cast(context).findElementsByImage(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByImage.class, FindsByFluentSelector.class);
}
 
源代码18 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByImage.class.isAssignableFrom(contextClass)) {
        return FindsByImage.class.cast(context).findElementByImage(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByImage.class, FindsByFluentSelector.class);
}
 
源代码19 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByCustom.class.isAssignableFrom(contextClass)) {
        return FindsByCustom.class.cast(context).findElementsByCustom(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElements(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByCustom.class, FindsByFluentSelector.class);
}
 
源代码20 项目: java-client   文件: MobileBy.java
/**
 * {@inheritDoc}
 *
 * @throws WebDriverException when current session doesn't support the given selector or when
 *      value of the selector is not consistent.
 * @throws IllegalArgumentException when it is impossible to find something on the given
 * {@link SearchContext} instance
 */
@Override public WebElement findElement(SearchContext context) {
    Class<?> contextClass = context.getClass();

    if (FindsByCustom.class.isAssignableFrom(contextClass)) {
        return FindsByCustom.class.cast(context).findElementByCustom(getLocatorString());
    }

    if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) {
        return super.findElement(context);
    }

    throw formIllegalArgumentException(contextClass, FindsByCustom.class, FindsByFluentSelector.class);
}