Fail-safe method for retrieving texts of given elements.
@param elements Any collection of WebElements
@return Array of texts (or exceptions in case of any WebDriverExceptions)
494835
public static List<String> texts(Collection<WebElement> elements) {
    return elements.stream().map(ElementsCollection::getText).collect(toList());
  }
750379
protected List<VariableExtractor> getVariableExtractors(Element element) {
        List<VariableExtractor> variableExtractors = new ArrayList<>();

        parseExtractHeaderElements(element, variableExtractors);

        Element extractElement = DomUtils.getChildElementByTagName(element, "extract");
        if (extractElement != null) {
            Map<String, String> extractFromPath = new HashMap<>();

            List<Element> messageValueElements = DomUtils.getChildElementsByTagName(extractElement, "message");
            messageValueElements.addAll(DomUtils.getChildElementsByTagName(extractElement, "body"));
            VariableExtractorParserUtil.parseMessageElement(messageValueElements, extractFromPath);

            if (!CollectionUtils.isEmpty(extractFromPath)) {
                VariableExtractorParserUtil.addPayloadVariableExtractors(element, variableExtractors, extractFromPath);
            }
        }
        return variableExtractors;
    }
751546
public List<WebElement> getElements() {
        List<WebElement> foundElements = null;
        try {
            if (parent == null) {
                foundElements = HtmlElementUtils.locateElements(getLocator());
            } else {
                foundElements = parent.locateChildElements(getLocator());
            }
        } catch (NoSuchElementException n) {
            addInfoForNoSuchElementException(n);
        }

        return foundElements;
    }
1137341
public static List<ModuleElement>
            modulesIn(Iterable<? extends Element> elements) {
        return listFilter(elements, MODULE_KIND, ModuleElement.class);
    }
411858
private List<XsdElement> getAllElementsRecursively(XsdAbstractElement element) {
        List<XsdElement> allGroupElements = new ArrayList<>();
        List<XsdAbstractElement> directElements = element.getXsdElements().collect(Collectors.toList());

        allGroupElements.addAll(
                directElements.stream()
                        .filter(elem1 -> elem1 instanceof XsdElement)
                        .map(elem1 -> (XsdElement) elem1)
                        .collect(Collectors.toList()));

        for (XsdAbstractElement elem : directElements) {
            if ((elem instanceof XsdMultipleElements || elem instanceof XsdGroup) && elem.getXsdElements() != null) {
                allGroupElements.addAll(getAllElementsRecursively(elem));
            }
        }

        return allGroupElements;
    }
518800
public static Text[] toTextArray(Document doc, Object o) throws PageException {
	// Node[]
	if (o instanceof Node[]) {
	    Node[] nodes = (Node[]) o;
	    if (_isAllOfSameType(nodes, Node.TEXT_NODE)) return (Text[]) nodes;

	    Text[] textes = new Text[nodes.length];
	    for (int i = 0; i < nodes.length; i++) {
		textes[i] = toText(doc, nodes[i]);
	    }
	    return textes;
	}
	// Collection
	else if (o instanceof Collection) {
	    Collection coll = (Collection) o;
	    Iterator<Object> it = coll.valueIterator();
	    List<Text> textes = new ArrayList<Text>();
	    while (it.hasNext()) {
		textes.add(toText(doc, it.next()));
	    }
	    return textes.toArray(new Text[textes.size()]);
	}
	// Node Map and List
	Node[] nodes = _toNodeArray(doc, o);
	if (nodes != null) return toTextArray(doc, nodes);
	// Single Text Node
	try {
	    return new Text[] { toText(doc, o) };
	}
	catch (ExpressionException e) {
	    throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Text Array");
	}
    }
155095
def texts(element)
        texts = []
        child_nodes = element.child_nodes
        (0...child_nodes.length).each do |i|
          item = child_nodes.item(i)
          if item.node_type == Node.TEXT_NODE
            texts << item.get_data
          end
        end
        texts
      end
1143986
@SuppressWarnings("unchecked")
    public static List<Element> elements(Element element, String name) {

        return element.elements(name);
    }
449608
public static List<Element> getChildElements(Element e) {

		List<Element> ret = new ArrayList<Element>();
		NodeList children = e.getChildNodes();

		for (int i = 0; i < children.getLength(); i++) {
			Node child = children.item(i);
			if (child.getNodeType()  == Node.ELEMENT_NODE) {
				ret.add((Element) child);
			}
		}

		return ret;
	}
1106412
@Override
	public List<WebElement> findElements(final By by) {
		return wef.by(by).findAll();
	}
905005
public static Elements findElementsByTag(Element element, String ... tags) {
		List<Element> results = new ArrayList<Element>();
		
		Set<String> tagSet = new HashSet<String>();
		for(String tag : tags) 
			tagSet.add(tag.toLowerCase());
		filterElementsByTag(results, element, tagSet);
		return new Elements(results);
	}
	
	private static void filterElementsByTag(List<Element> results, Element element, Set<String> tagSet) {
		if(tagSet.contains(element.tag().getName().toLowerCase())) 
			results.add(element);
		
		for(Element child : element.children())
			filterElementsByTag(results, child, tagSet);
	}

	/** Returns the first element found with the given tag (or tag sequence separated by '/') or null. */
	public static Element findFirstByTag(Element element, String tag) {
		return findFirstByTag(element, tag.split("/"), 0);
	}
	
	private static Element findFirstByTag(Element current, String [] tags, int index) {
		if(index < tags.length) {
			Elements elements = current.getElementsByTag(tags[index]);
			for(Element element : elements) {
				Element result = findFirstByTag(element, tags, index + 1);
				if(result != null)
					return result;
			}
			return null;
		}
		else
			return current;
	}
    
}
1125031
@SafeVarargs
	public static <E> ArrayList<E> newArrayList(E... elements) {
		ArrayList<E> list = new ArrayList<E>();
		Collections.addAll(list, elements);
		return list;
	}
698670
function(webElems) {
      var texts = webElems.then(function(arr) {
        var results = arr.map(function(webElem) {
          return webElem.getText();
        });
        return webdriver.promise.all(results);
      });

      expect(texts).not.toContain('e');

      return true;
    }
956792
public static <T> Level0ArrayOperator<Long[],Long> onArrayFor(final Long... elements) {
        return onArrayOf(Types.LONG, VarArgsUtil.asRequiredObjectArray(elements));
    }
715686
public static String stringSetToTextArea(Set<String> elements) {
		StringBuilder sb = new StringBuilder();
		if (elements != null) {
			for (String element : elements) {
				sb.append(element);
				sb.append(TEXTAREA_ELEMENTS_SEPARATOR);
			}
		}
    	int length = sb.length();
		return sb.substring(0, length > 0 ? length - 1 : 0);
	}
564376
@SafeVarargs
  public static <E> Set<E> of(E... elements) {
    Set<E> result = new HashSet<>();
    Collections.addAll(result, elements);
    return Collections.unmodifiableSet(result);
  }
115403
public <T> List<T> randomElements(List<T> elements, int count) {
		if (elements.size() >= count) {
			return extractRandomList(elements, count);
		} else {
			List<T> randomElements = new ArrayList<T>();
			randomElements.addAll(extractRandomList(elements, count % elements.size()));
			do {
				randomElements.addAll(extractRandomList(elements, elements.size()));
			} while (randomElements.size() < count);
			return randomElements;
		}
	}