答えて

1

シンプルなGETストリーム、文字列(テキスト)にマップし、任意の一致かどうかを確認:

boolean anyMatch = webelements.stream() 
    .map(WebElement::getText) 
    .anyMatch(text -> "inside".equals(text)); 

が安全フィルタアウトヌルのこととトリムするには:

boolean anyMatch = webelements.stream() 
    .map(WebElement::getText) 
    .filter(Objects::nonNull) 
    .map(String::trim) 
    .anyMatch(text -> "inside".equals(text)); 
+0

おかげで、返事を。私はそれを主張に入れたいので、私はそれを主張する必要がありますか? – gagatek

+0

確かに 'assertTrue(anyMatch)'が動作します。 – pejas

+0

ありがとうございました!!!! – gagatek

関連する問題