Problem with @AndroidFindBy(..)

hi there,
I have a doubt about use @AndroidFindBy - this locator of elements,
Do i have initialize first in any way? or this is enough?
I paste the example:
@AndroidFindBy(id=“com.theamalgama.bataxi.passenger:id/login_nativo_email_editText_id”)
public WebElement emailField;

i hope you can understand my question,
thank you

in most cases it is like:

@AndroidFindBy(id="login_nativo_email_editText_id")
public AndroidElement emailField;

you should use FULL id only if you switch to some other screen but not test client. e.g. you are testing client but need to open native SMS application and check there recieved SMS.

initialization happens later in here:

PageFactory.initElements(new AppiumFieldDecorator(driver, 5, TimeUnit.SECONDS), this);

see example -> https://github.com/appium/java-client/blob/master/src/test/java/io/appium/java_client/pagefactory_tests/AndroidPageObjectTest.java

1 Like

hi @Aleksei! . Thank you so much!! You really helped me with both tips.
Change the id and use the pageFactory services.
Thank u again.