-
-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page Object design extension question #320
Comments
It is not a bug. It works by design.
If it is interesting I can describe how does it work. IOSElement fieldElement = items.nameElement; // fieldElement is null because items is not the real object. It is a proxy created via CGLIB. A real object with populated fields is instantiated once when any declared method is invoked. But it stays not available anyway. I'm waiting for your response. |
@TikhomirovSergey, thanks for responce. I've just read the requirements and in most cases in project our team comply them. But in this situation I need to interact with sub-elements in widject directly. Like this: public class Movies {
@iOSFindBy(uiAutomator = ".tableViews()[0].cells()")
public List<Movie> items;
public void swapMovies(int indexA, int indexB) {
Point centerA = items.get(indexA).getNameElement().getCenter();
Point centerB = items.get(indexB).getNameElement().getCenter();
getDriver().swipe(centerA.getX(), centerA.getY(), centerB.getX(), centerB.getY(), DEFAULT_DURATION);
// and so on
}
} Of cource I understand that I can make simple So, everything is okey if we get fields via reflection from pages. And we supposed that widgets work familiar. But they don't. Sergey, I'll be so grateful to you, if you'll explain how does this work. And why in one case I got null at other an object. |
BTW. Don't afraid about cross-platform. We simply don't need it :) |
You can propose a PR if you want :) Also don't forget to add a test if you want to try. |
@SButterfly You can: - switch to your java_client fork using git - > git checkout -b your_new_branch_name master - > git pull https://github.com/User_Name/java-client.git target_branch But now you can clone master
This issue has been fixed and it is going to be published soon |
Hello,
I'm using new page object design with Widget class. And recently caught some unexpected behaviour.
Let me describe my classes:
And these classes I use smth like this:
Why does it work so?
Are there any ways to get element directly from field without creating getter?
The text was updated successfully, but these errors were encountered: