testbench icon indicating copy to clipboard operation
testbench copied to clipboard

Allow to use getNoSuchElementMessage in ElementQuery

Open hons82 opened this issue 1 year ago • 0 comments

The ElementQuery class contains a very nice method to create a meaningful "NoSuchElement"-Message for a NoSuchElementException.

private String getNoSuchElementMessage(Integer index) {
    String msg = "No element with tag <" + tagName + "> found";
    String attrPairs = getAttributePairs();
    if (!attrPairs.isEmpty()) {
        msg += " with the attributes " + attrPairs;
    }
    if (index != null) {
        msg += " using index " + index;
    }
    return msg;
}

I'd like to use this message in a custom NoSuchElementException where this method would come in handy, but unfortunately it is declared private.

Would it be possible to change the access modifier to public (final)?

hons82 avatar Feb 07 '23 11:02 hons82