-
-
Notifications
You must be signed in to change notification settings - Fork 765
Closed
Description
I've been trying for a couple of days to get iOSFindBy & AndroidFindBy annotations working with page objects and the PageFactory. I've tried versions 2.2.0 and 3.0.0 of the java-client and tests for Android and iOS, all with the same result - which is the same as not including any annotations.
Here is a truncated version of one of my page objects
public class HomePhonePage extends BaseHomePage {
public HomePhonePage(AppiumDriver driver) {
super(driver);
PageFactory.initElements(new AppiumFieldDecorator(driver,
IMPLICIT_WAIT,
TimeUnit.SECONDS),
this
);
}
@iOSFindBy(accessibility = "home_landing_my_favorites_count_label")
private WebElement myFavoritesCountLabel;
public String getMyFavoritesCountLabel() {
return myFavoritesCountLabel.getText();
}
}My test code:
@Test
public void testHomeIsValid() {
homePhonePage = new HomePhonePage(driver);
globalNavPage = new GlobalNavigationPage(driver);
homePhonePage.clickHamburgerMenu(); //FAILS HERE because element was not found
globalNavPage.clickHome();
}When I debug into PageFactory.initElements, I see [unknown locator] for each property that is a WebElement. Then the PageFactory defaults to looking for each page object's property name as the id or name of the WebElement and fails to find anything.
I suspect "I'm doing it wrong" but I can't figure out where. It is behaving as if the annotations are not even there.
Metadata
Metadata
Assignees
Labels
No labels
