Assert an element exists matching the given selector.
421433
def check_element_by_selector(self, selector):
    """"""
    elems = find_elements_by_jquery(world.browser, selector)
    if not elems:
        raise AssertionError("Expected matching elements, none found.")
936849
def match(self, selector, index):
        """"""

        pseudo = None
        m = self.re_pseudo_name.match(selector, index)
        if m:
            name = util.lower(css_unescape(m.group('name')))
            pattern = self.patterns.get(name)
            if pattern:
                pseudo = pattern.match(selector, index)
                if pseudo:
                    self.matched_name = pattern

        return pseudo
1116889
function matchSelector(element, selector) {
        if (!element || element.nodeType !== 1) {
            return false
        }

        var parent,
            match,
            matchesSelector = element.webkitMatchesSelector || element.matchesSelector;

        if (matchesSelector) {
            match = matchesSelector.call(element, selector)
        } else {
            parent = element.parentNode;
            match = !! parent.querySelector(selector);
        }

        return match;
    }
280030
function contains(arr, element) {
        for (var i = 0, len = arr.length; i < len; i++) {
            if (arr[i] === element) {
                return true;
            }
        }
        return false;
    }
1043952
function matches(elem, selector) {
  // We'll use querySelectorAll to find all element matching the selector,
  // then check if the given element is included in that list.
  // Executing the query on the parentNode reduces the resulting nodeList,
  // document doesn't have a parentNode, though.
  var nodeList = ( elem.parentNode || document ).querySelectorAll( selector ) || [],
      i = nodeList.length;

  // loop on the nodeList
  while ( i-- ) {
    if ( nodeList[i] == elem ) { return true; }
  }
  return false;
}
779696
function elementMatches (el, selector) {
  if (el.matches) { return el.matches(selector) }
  if (el.msMatchesSelector) { return el.msMatchesSelector(selector) }
  if (el.webkitMatchesSelector) { return el.webkitMatchesSelector(selector) }
}
334604
function isReactElement(suspectedElement) {
    var isElem = false;
    if (React.isValidElement(suspectedElement)) {
        isElem = true;
    } else if (Array.isArray(suspectedElement)) {
        for (var i = 0, l = suspectedElement.length; i < l; i++) {
            if (React.isValidElement(suspectedElement[i])) {
                isElem = true;
                break;
            }
        }
    }
    return isElem;
}
1148642
public boolean getElementExists(By locator) {
		waitForLoaders();
		List<WebElement> foundElements = getWebDriver().findElements(locator);
		return (foundElements.size() > 0);
	}
1144607
function contains( element, className ) {
  className = className.replace( '.', '' );
  if ( hasClassList ) {
    return element.classList.contains( className );
  }

  return element.className.indexOf( className ) > -1;
}
926877
function find(el, selector) {
  if (!selector) {
    selector = el;
    el = document;
  }
  return el.querySelector(selector);
}
43153
function hasClass(el, className) {
    if (!el || !className) {
      return;
    }
    return (new RegExp('(^|\\s)' + className + '(\\s|$)').test(el.className));
  }
495752
def has_selector(selector):
    ""
    try:
        if selector == 'poll':
            # the select module offers the poll selector even if the platform
            # doesn't support it. Attempt to poll for nothing to make sure
            # poll is available
            p = select.poll()
            p.poll(0)
        else:
            # the other selectors will fail when instantiated
            getattr(select, selector)().close()
        return True
    except (OSError, AttributeError):
        return False
542159
function (selector, value) {
    return this.waitForDOM(selector).execute(function (selector, value) {
      var element = document.querySelector(selector);
      if (element) {
        element.value = value;
      }
    }, [ selector, value ]);
  }
20380
function (selector, done) {
  this.evaluate_now((selector) => {
    let element = document.querySelector(selector)
    if (!element) {
      return false
    }

    for (let key in element) {
      if (key.startsWith('__reactInternalInstance$')) {
        return true
      }
    }

    return false
  }, done, selector)
}
413076
def contains(self, element, key=lambda x: x):
        
        return self.select(key).any(lambda x: x == key(element))
690463
def match_subselectors(self, el, selectors):
        """"""

        match = True
        for sel in selectors:
            if not self.match_selectors(el, sel):
                match = False
        return match
838575
@Then("^the element on index '(\\d+?)' (IS|IS NOT) enabled$")
    public void assertSeleniumIsEnabled(Integer index, Boolean isEnabled) {
        assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required")
                .hasAtLeast(index);
        assertThat(this.commonspec, commonspec.getPreviousWebElements().getPreviousWebElements().get(index).isEnabled())
                .as("Unexpected element enabled property").isEqualTo(isEnabled);
    }