ElementsCollection annotated with @FindBy is not initialized #186

Closed
rishaselfing opened this Issue Jun 23, 2015 · 3 comments

Projects

None yet

2 participants

@rishaselfing

When using Page Object pattern PageFactory does not decorate ElementsCollection fields, so I'm getting NullPointerException. You can reproduce it on your own Google classic page object example.

@rishaselfing rishaselfing changed the title from ElementsCollection annotated with @FindBy is not initialised to ElementsCollection annotated with @FindBy is not initialized Jun 23, 2015
@asolntsev
Member

Thank you for reporting, I will investigate it asap.

@asolntsev asolntsev closed this in 92394db Jun 23, 2015
@asolntsev asolntsev added this to the 2.20 milestone Jun 23, 2015
@asolntsev asolntsev added the ready label Jun 23, 2015
@asolntsev asolntsev self-assigned this Jun 23, 2015
@asolntsev
Member

Hi @rishaselfing !
In the "classic_page_object" folder, there is a test using pure Selenium code. I mean, class org.selenide.examples.google.classic_page_object.GoogleTest does not use Selenide. It uses selenium built-in factory org.openqa.selenium.support.PageFactory. It's not supposed to support Selenide classes.

Thought, you are right, Selenide page factory actually cannot inject ElementsCollection fields.
I have fixed it in Selenide 2.20 (it's not released yet). I have also added such an example to Google example:
https://github.com/selenide-examples/google/tree/master/test/org/selenide/examples/google/selenide_page_object_with_fields

@rishaselfing

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment