Tag: selenide

过滤ElementsCollection

我正在尝试创建一个过滤ElementsCollection的函数,在每个元素的子ElementsCollection上使用条件而不是元素本身。 这就是我想出的: public static ElementsCollection filterByChild(ElementsCollection elementsCollection, String childCssSelector, Condition condition) { Predicate childHasConditionPredicate = element -> element.$(childCssSelector).has(condition); elementsCollection.removeIf(childHasConditionPredicate); return elementsCollection; } 调用此函数时,如下所示: myCollection = SelenideHelpers.filterByChild(myCollection, “a”, Condition.text(“http://www.link.com”); 我收到以下错误消息: java.lang.UnsupportedOperationException: Cannot remove elements from web page 我没有找到任何可以应用于我的代码的错误消息的相关信息。 我想知道为什么会出现此消息。