Get text
Sat Jun 10 2023 13:14:24 GMT+0000 (Coordinated Universal Time)
Saved by
@mehran
By byText = MobileBy.AndroidUIAutomator("new UiSelector().text(\"" + elementText + "\")");
WebElement element = driver.findElement(byText);
element.click();
if (driver.getPageSource().contains("خرید")) {
LOGGER.info("PASS");
} else {
LOGGER.error("Test failed ");
Assert.fail("Test failed ");
}
}
////////////////////
WebElement element2 = driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().text(\"امکان فعالسازی همزمان دو بسته وجود ندارد.\")"));
////////////////////
WebElement element4 = driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().text(\"خرید مودم\")"));
/////////////////
public static void verifySnackbarText(WebDriver driver, String expectedText) {
String snackbarText = driver.findElement(By.id("ir.mci.ecareapp:id/snackbar_text")).getText();
if (snackbarText.equals(expectedText)) {
System.out.println("Pass");
} else {
String pageName = getExecutingClassName();
Screenshot.takeScreenshotIfSnackbarVisible(driver, pageName);
System.out.println("Fail");
Assert.fail("Test failed");
}
}
content_copyCOPY
Comments