An expectation for checking an element is visible and enabled such that you can click it.

@param element the WebElement
@return the (same) WebElement once it is clickable (visible and enabled)
429321
public static ExpectedCondition<WebElement> elementToBeClickable(final WebElement element) {
    return new ExpectedCondition<WebElement>() {

      @Override
      public WebElement apply(WebDriver driver) {
        WebElement visibleElement = visibilityOf(element).apply(driver);
        try {
          if (visibleElement != null && visibleElement.isEnabled()) {
            return visibleElement;
          }
          return null;
        } catch (StaleElementReferenceException e) {
          return null;
        }
      }

      @Override
      public String toString() {
        return "element to be clickable: " + element;
      }
    };
  }
1332948
public void waitForElementToBeVisible(final By by, final int maximumSeconds) {
		WebDriverWait wait = new WebDriverWait(driver, maximumSeconds);
		wait.until(ExpectedConditions.visibilityOfElementLocated(by));
	}
559952
public static ExpectedCondition<Boolean> stalenessOf(final WebElement element) {
    return new ExpectedCondition<Boolean>() {
      @Override
      public Boolean apply(WebDriver ignored) {
        try {
          // Calling any method forces a staleness check
          element.isEnabled();
          return false;
        } catch (StaleElementReferenceException expected) {
          return true;
        }
      }

      @Override
      public String toString() {
        return String.format("element (%s) to become stale", element);
      }
    };
  }
683162
public static boolean isMainElement( Element element ){
        switch( element.getType() ) {
            case START:
            case END:
            case VALUE:
            case CALL:
            case CALL_ASYNC:
            case HUMAN_TASK:
            case WAIT_SIGNAL:
            case WAIT_TIMER:
            case WAIT_UNTIL_DATE:
            case CREATE_INSTANCE:
            case WHILE_DO_BEGIN:
            case WHILE_DO_END:
            case DO_WHILE_BEGIN:
            case DO_WHILE_END:
            case IF:
            case ELSE_IF:
            case ELSE:
            case END_IF:
            case SPLIT:
            case BRANCH:
            case JOIN_FIRST:
            case JOIN_ALL:
            case ESCALATE:
            case VALIDATE_INPUT_VARIABLE:
                return true;
            default :
                return false;
        }
    }
1004816
public static org.w3c.dom.Element convertElement(Element element) {
        return NodeAdaptors.getElement(element);
    }
166421
private static boolean isAvailable(WebElement element) {
        return element.isDisplayed() || isElementHiddenUnderScroll(element)
                && !element.getCssValue("visibility").equals("hidden");
    }
209369
public boolean somethingSelected() {
        boolean isSelected = false;
        if (input()) {
            WebElement webElement = element.getWebElement();
            if ("input".equalsIgnoreCase(webElement.getTagName())) {
                isSelected = webElement.isSelected();
            } else if (SELECT.equalsIgnoreCase(webElement.getTagName())) {
                Select dropdown = new Select(webElement);
                isSelected = !dropdown.getAllSelectedOptions().isEmpty();
            }
        }
        return isSelected;
    }
387058
public boolean isBefore(T element) {
    if (element == null) { return false; }
    return comparator.compare(element, max) > 0;
  }
1067598
public static boolean isElement(Node node) {
		return (null == node) ? false : Node.ELEMENT_NODE == node.getNodeType();
	}
496906
public static void setEnabled(Element element, boolean enabled) {
        element.setPropertyBoolean("disabled", !enabled);
	setStyleName(element, "disabled", !enabled);
    }
388834
public static boolean hasEditable(Element element) {

        NodeList<Element> children = CmsDomUtil.querySelectorAll(FIELD_SELECTOR, element);
        return (children != null) && (children.getLength() > 0);
    }
539161
public ArrayList<String> getAvailableOptions(WebElement element) {
        ArrayList<String> result = null;
        if (isInteractable(element)
                && "select".equalsIgnoreCase(element.getTagName())) {
            result = new ArrayList<String>();
            List<WebElement> options = element.findElements(By.tagName("option"));
            for (WebElement option : options) {
                if (option.isEnabled()) {
                    result.add(option.getText());
                }
            }
        }
        return result;
    }
1330534
def is_element_available(self, locator):
        
        if self.driver.is_element_present(locator):
            if self.driver.is_visible(locator):
                return True
            else:
                return False
        else:
            return False
395943
public boolean contains(final T element) {
        if (element == null) {
            return false;
        }
        return comparator.compare(element, minimum) > -1 && comparator.compare(element, maximum) < 1;
    }
860604
public static ExpectedCondition<Boolean> invisibilityOfElementLocated(final By locator) {
    return new ExpectedCondition<Boolean>() {
      @Override
      public Boolean apply(WebDriver driver) {
        try {
          return !(driver.findElement(locator).isDisplayed());
        } catch (NoSuchElementException e) {
          // Returns true because the element is not present in DOM. The
          // try block checks if the element is present but is invisible.
          return true;
        } catch (StaleElementReferenceException e) {
          // Returns true because stale element reference implies that element
          // is no longer visible.
          return true;
        }
      }

      @Override
      public String toString() {
        return "element to no longer be visible: " + locator;
      }
    };
  }
1222892
static final String xpath(Element element) {
        StringBuilder sb = new StringBuilder();

        Node iterator = element;
        while (iterator.getNodeType() == Node.ELEMENT_NODE) {
            sb.insert(0, "]");
            sb.insert(0, siblingIndex((Element) iterator) + 1);
            sb.insert(0, "[");
            sb.insert(0, ((Element) iterator).getTagName());
            sb.insert(0, "/");

            iterator = iterator.getParentNode();
        }

        return sb.toString();
    }
459062
protected boolean addElem(final T element) {
    // validate element
    if (element == null) {
      throw new IllegalArgumentException("Null element is not supported.");
    }
    // find hashCode & index
    final int hashCode = element.hashCode();
    final int index = getIndex(hashCode);
    // return false if already present
    if (containsElem(index, element, hashCode)) {
      return false;
    }

    modification++;
    size++;

    // update bucket linked list
    DoubleLinkedElement<T> le = new DoubleLinkedElement<T>(element, hashCode);
    le.next = entries[index];
    entries[index] = le;

    // insert to the end of the all-element linked list
    le.after = null;
    le.before = tail;
    if (tail != null) {
      tail.after = le;
    }
    tail = le;
    if (head == null) {
      head = le;
    }
    return true;
  }