I have added the new category and I want to check whether a category is added or not and I don’t have Id for the category , how I check whether my category is added or not?
try to find element by using visible text (category name):-
For Android:-
driver.findElement(MobileBy.AndroidUIAutomator(“new UiSelector().textContains(\“category name\”)”)).isDisplayed();
For iOS:-
driver.findElement(MobileBy.iOSNsPredicateString(“value CONTAINS ‘category name’")).isDisplayed();
//if value don’t work try with name
I have tried with UI selector but it is not working
driver.findElement(By.xpath("//android.widget.TextView[contains(text(),‘Happy’)]")).click();
and
driver.findElementByAndroidUIAutomator(“new UiSelector().textContains(“Happy”)”);
I have tried with 2 ways but it gives me error
i think you need to put visible text in double quotes:-
driver.findElement(MobileBy.AndroidUIAutomator(“new UiSelector().textContains(\““happy”\”)”)).isDisplayed();
which error you are getting? elementnotfoundexception or something else
@Ajinkya Example with page object:
@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Messaging\")")
private List<AndroidElement> messagingLink;
@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Gmail\")")
private List<AndroidElement> gmailLink;