PageFactory.initElements() doesn't always guarantee the objects are initialized- assertion fails - running on real iPhones


i am tying to run appium tests on 2 real iPhones using the pages design patterns.
The objects on each page are initialized using annotations like this:

@iOSFindBy(name = "Custom menu.")

protected MobileElement customMenuBtn;

and when a new page is created i use : PageFactory.initElements to initialize it.

When a new page is created an assertion is made to verify i am on the right page:

public void assertInPage() {
try {

    catch (Exception e) {


Waiting for this element of a page that exist and isn’t null sometimes fail and i get NoSuchElementException
This error is inconsistent and it can happen at the first time i create this page or after i return to it.
I can’t try it on simulators so i am running on real devices.
Is it possible the initelements doesn’t actually init all elements even though they are all visible on screen.
I am using appium 1.3.4 and 1.3.5 and it happens in both.

Have been stuck on this for a few days now , any ideas …?

still stuck on this issue.
would appreciate any suggestion from the appium guys :smile: