public ListSizeMismatch(Driver driver, String operator, int expectedSize, String explanation, WebElementsCollection collection, List<WebElement> actualElements, Exception lastError, long timeoutMs) { super(driver, ": expected: " + operator + " " + expectedSize + (explanation == null ? "" : " (because " + explanation + ")") + ", actual: " + (actualElements == null ? 0 : actualElements.size()) + ", collection: " + collection.description() + "\nElements: " + elementsToString(collection.driver(), actualElements), lastError ); super.timeoutMs = timeoutMs; }
@Override public String toString() { try { return elementsToString(driver(), getElements()); } catch (Exception e) { return String.format("[%s]", Cleanup.of.webdriverExceptionMessage(e)); } }