Difference between AndroidFindAll and HowtoUseLocators ALL_POSSIBLE

Hi all, I’ve read a lot of about that (all the appium doc of course) but I couldn’t find a good explanation. My understanding is that HowtoUseLocators ALL_POSSIBLE looks for all the locators on the list and when find one, stops looking. But does AndroidFindAll the same? What is the difference between both? Also, can both be used at the same time? Thanks in advance!

Code example:

@HowToUseLocators(androidAutomation = ALL_POSSIBLE) 
@AndroidFindBy(fakeID1)
@AndroidFindBy(someStrategy2)
MobileElement someElement;

@AndroidFindAll{
     @AndroidFindBy(fakeID1),
     @AndroidFindBy(someStrategy2)
})
MobileElement someElementA;

No differece. Only that you can create even more complex!

@HowToUseLocators(androidAutomation = ALL_POSSIBLE) 
@AndroidFindBy(fakeID1)
@AndroidFindBy(someStrategy2)
@AndroidFindBys{
     @AndroidFindBy(fakeID3),
     @AndroidFindBy(someStrategy3)
})
MobileElement someElementA;

Thanks for your explanation. So, this have the same behaviour than your example?

@AndroidFindAll{
     @AndroidFindBy(fakeID1)
     @AndroidFindBy(someStrategy2)
     @AndroidFindBys{
         @AndroidFindBy(fakeID3),
         @AndroidFindBy(someStrategy3)
    }
}

Thanks!

did not ever try AndroidFindBys inside AndroidFindAll. here tons of examples -> https://github.com/appium/java-client/blob/master/src/test/java/io/appium/java_client/pagefactory_tests/AndroidPageObjectTest.java

1 Like