Help me to use WebDriverWait (Explicit wait) with Appium In Test

I have some problems to use WebDriverWait (Explicit wait) with Appium in my Test. I need to know how many elements are visible.
I use appium 1.4.16.

See screenshort.

Can somebody explain me?

How are you setting up your driver object?

protected iOSDriver iosdriver

Ah, there we go.

In Java, your references are not properly initialized just be declaring them. By default, class member variables that are not primitives (that is, anything that is not an int, char, byte, long, double, boolean, short) are set to null.

If you want to properly set these values, you have to call the constructor of the class of the reference’s type. In this case, you want to do something like this to iosdriver:

iosdriver = new IOSDriver(new URL(<URL to Appium server>), <capabilities reference>);

Have you had a chance to introduce yourself to Java yet?

iosDriver = new IOSDriver(new URL(REMOTE_APPIUM_URL), capabilities);
In my case, I have done like this.
I have the class name Step, where i write steps(methods) to work with elements, in this class i need to use WebDriverWait. In class Test i call steps from a class Step

You want to ensure that your code that calls the IOSDriver constructor occurs before any other code that uses the driver reference. Double-check your code flow to ensure this is the case.

You also want to make sure you do not have code that sets driver back to null between where you’ve initialized driver and where you use driver.

1 Like