Skip to content

Page Object design extension question #320

Closed
@SergeyErmakovMercDev

Description

@SergeyErmakovMercDev

Hello,
I'm using new page object design with Widget class. And recently caught some unexpected behaviour.
Let me describe my classes:

public class Movies {
    @iOSFindBy(uiAutomator = ".tableViews()[0].cells()")
    public List<Movie> items;
}

public class Movie extends Widget {
    @iOSFindBy(uiAutomator = ".staticTexts()[0]")
    public IOSElement nameElement;

    public IOSElement getNameElement() {
       return nameElement;
    }
}

And these classes I use smth like this:

Movies movies = ...
List<Movie> items = movies.items; //items is not null
Movie item = items.get(0);

IOSElement fieldElement = item.nameElement; // fieldElement is null
IOSElement methodElement = item.getNameElement(); // methodElement is not null

Why does it work so?
Are there any ways to get element directly from field without creating getter?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions