Not able to use Page factory model with appium

Platform you are automating : Android
Appium version : 1.7.1
Simulator/Emulator or Real Device: Real Device
The language you are using for writing tests (client binding) : Java
Your OS : MAC OS Sierra
Java Client : 5.0.4
Selenium version: 3.4.0

Not able to use page factory model framework with appium, getting below error in my java code:


I would start with java_client upgrade , the latest one is 5.0.4 already …

I mistakenly wrote selenium version in my original post for java client version, i am using 5.0.4 only

Is the code for fluent wait running without POM.

It seems to be an issue of class imported in fluent wait code not working with selenium or unavailability of jar file.

Just try with selenium-support jar with latest version and you should you have guava jar with 21.0 version.

Thanks for the reply, but its still not working. Below is my constructor of class which is using page factory, i am using 22 version of guava and 3.4.0(latest) of selenium-support as my selenium version is 3.4.0:

public AndroidAppHome(AppiumDriver(MobileElement) androidDriver){
PageFactory.initElements(new AppiumFieldDecorator(androidDriver),this);

Also please find error log in selenium:

at io.appium.java_client.pagefactory.AppiumElementLocator.waitFor(
at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(
at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.testng.internal.MethodInvocationHelper.invokeMethod(
at org.testng.internal.Invoker.invokeMethod(
at org.testng.internal.Invoker.invokeTestMethod(
at org.testng.internal.Invoker.invokeTestMethods(
at org.testng.internal.TestMethodWorker.invokeTestMethods(
at org.testng.TestRunner.privateRun(
at org.testng.SuiteRunner.runTest(
at org.testng.SuiteRunner.runSequentially(
at org.testng.SuiteRunner.privateRun(
at org.testng.SuiteRunnerWorker.runSuite(
at org.testng.TestNG.runSuitesSequentially(
at org.testng.TestNG.runSuitesLocally(
at org.testng.TestNG.runSuites(
at org.testng.remote.RemoteTestNG.initAndRun(
at org.testng.remote.RemoteTestNG.main(

I am not using fluentwait anywhere in my code.

However there is one class ‘AppiumElementLocator’ under src/main/java/io/appium/java_client/pagefactory on github which is using fluentwait, that might be causing some trouble.

It worked with latest jars:

Appium 1.7.1
Java-client 5.0.4
Selenium-java 3.7.1

Even I was facing the same issue while using : io.appium java-client: 5.0.4, selenium-java: 3.3.0, guava: 24.0-jre.

On using: io.appium java-client: 6.1.0, selenium-java: 3.11.0, guava: 24.0-jre, this issue got resolved.