下面列出了org.openqa.selenium.SearchContext#getClass ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}
/**
* {@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);
}