public void auto_verifyText(String xpath, String expectedText) {
ElementHandle element = (ElementHandle) page.locator(xpath).first();
if (element == null) {
throw new AssertionError("Element not found withn XPath: " + xpath);
}
String actualText = element.textContent();
if (!actualText.equals(expectedText)) {
throw new AssertionError("Text does not match. Expected: " + expectedText + ", Actual: " + actualText);
}
}
Popular Search autoautsettextttr