Using page object model with appium - PageFactory.initElements not working

hi, i have a weird scenario…
i am trying to convert my project into POM using PageFactory.
i created a login page and i want to use the @AndroidFindBy annotations

but the program throws the following error:
java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy10.proxyClassLookup()

i know that basically it creates a “lazy proxy” which locates the element when action is made.
so my guess that it is somehow related.

My Code:
public class LoginScreen {

@AndroidFindBy(id="**company name**:id/com_auth0_lock_input")
protected WebElement emailEl;

public LoginScreen(AppiumDriver driver) throws NoSuchFieldException {
    PageFactory.initElements(new AppiumFieldDecorator(driver),this);

public void enterEmail(String email){


i run it from the related test class(creates a LoginScreen object)
it fails at the initElements()

now for the weird part…
when i am using @FindBy annotation (should be web context…)
and! omitting the AppiumFieldDecorator it works fine.

i am using the latest appium version 7.6
and using jdk 17

any thoughts?

if i won’t have a choice i’ll build my pages with By fields instead of WebElements…

  1. update code with time:
// 10 sec to search elements. Otherwise with it uses default = 1 sec
PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(10)), this);
  1. you may use only last part of ID. package name should add Appium itself. Example:
@AndroidFindBy(id = "iv_delete")
private WebElement deleteContactButton;
  1. finally switch to JDK 11 ->
1 Like

thanks but still the same…

with JDK 11? are you sure you are with correct JDK?
PS I am with 11 and have no problems here

worked. thank you very much!!
actually, i changed the project jdk and forgot to change the module as well…:sweat_smile:

hi, additionally, i have two questions, i would be glad if you could answer… thanks again.

  1. do you know the right way to integrate WebDriverWait with POM? specifically how to find child element with annotations… or i should use [visibilityOfNestedElementsLocatedBy], if you have an example it would be great.
  • should i catch the wrapper element and filter with it the sub element or maybe there is an annotation for that?
  1. do you maybe have a link for a good tutorial on appium different way of annotations? because all i found is just about ‘AndroidFindBy’ and not other ones.

you can use appium annotation to find whatever:

    // example with iOS for chain. fist find element with 'PitchView' -> than element inside with id = `bottomButton`
    @iOSXCUITFindBys(value = {
            @iOSXCUITBy(id = "PitchView"),
            @iOSXCUITBy(id = "bottomButton")
    @AndroidFindBy(id = "gotItButton")
    private WebElement gotItButton;

more to read with tons examples ->

1 Like