Android Automation using Appium: I am trying to verify/validate the snackbar. but Appium Inspector is not identifying the locators for snackbar. please help me how to validate the snackbar content.
The easiest way to handle it is to check the source code of your Android application. Assuming you have a text view and button in Snackbar, you should be able to find smth like this:
<view
class="android.support.design.internal.SnackbarContentLayout"
>
<TextView
android:id="@+id/snackbar_text"/>
<Button
android:id="@+id/snackbar_action"
android:visibility="gone"/>
</view>
If id
is not in place, I suggest to add them by yourself.
Now you should be able to spot your snack bar, get the text or click the button:
FluentWait<WebDriver> wait = new WebDriverWait(driver, 10, 100).ignoring(NoSuchElementException.class);
wait.until(visibilityOfElementLocated(By.id("snackbar_text")));