auto_verifyTextMatchInList

    public void auto_verifyTextMatchInList(String parentXPath, List<String> textList) {
        for (String text : textList) {
            String completeXPath = String.format(parentXPath, text);
            auto_waitForElementsVisibilities(completeXPath);
            List<ElementHandle> elements = page.locator(completeXPath).elementHandles();
            softAssertions.assertThat(elements.stream().anyMatch(x -> {
                String innerText = x.textContent();
                System.out.println("Comparing: " + innerText + " with " + text);
                return innerText != null && innerText.contains(text);
            })).as("Element not displayed: " + text).isTrue();
        }
        softAssertions.assertAll();
    }
What are your feelings
Scroll al inicio