I have a scenario where I need to check that the contacts are displayed on app home screen(which are added from different part of the app).
There are 2 contacts in home screen, one is online and one is offline the source looks like this.(If the contact is added and online in another phone with same app. If the contact doesn’t have the app on his phone he is offline, hence the number of tags are less in the case of second contact.)
If I delete the contact then the elements on the screen change accordingly so is the app source.
We can add maximum of 3 contacts in this screen and if the contact is not there the elements are not displayed.
Can we automate Appium to check if there are 2 contacts(if there are online or offline) or 3 contacts and then proceed with performing actions like clicking on them ,get text etc. How to handle these dynamic elements.
I have identified all the elements in case where three contacts are added and performed actions but the test cases fail if any one of the elements is not present with NoSuchElementException , because that contact is not there on screen or if the contact is offline that particular element is not present.How to handle.