Not able to find an element of navigation bar for iOS App

Name of bar buttons on navigation bar doesn’t work, when we navigate from one screen to another screen, and again come bak to same screen, appium doesn’t recognise the same element.

Could you provide more details?

i.e. I have one navigation bar view with “X” and “Next” button, we can come on this page from various screen, so if i come in normal scenario from previous screen to this screen it works fine, but if i go to next screen and again come back to this screen or come on this screen from another screen, it doesn’t work.

<img src="/uploads/default/original/2X/3/35bd6b1fa0adbb1f1018bbf29c5a728b4f2bc02d.png" width="690" height="120">

Try print the source, and check that what you are looking for is there and that the selector is correct.

How will i print the source in the native app?

If you are working on a native app, its always advised to use ID. To get the ID for each element in screen, Load the Page in device/emulator.

Then go to Android SDK tools directory and run uiautomatorviewer

You can use AppiumDoctor as well [which internally calls uiautomatorviewer]

i am working on iOS native app and using accessibilityId of controls, but we can not set Id for navigation bar buttons.

Sorry, My Bad, I did not see iOS on the subject… :frowning: