Skip to content
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

@FindBy annotation is not being initialized #3466

Closed
SrivaniChennupati opened this issue May 12, 2024 · 4 comments
Closed

@FindBy annotation is not being initialized #3466

SrivaniChennupati opened this issue May 12, 2024 · 4 comments

Comments

@SrivaniChennupati
Copy link

from 4.1.8 , @findby annotation is not getting initialized , Here is an example

I have LaunchPage.java where i have initialized properties username and password.

image

LaunchPage.java is referenced like this from base class as follows

image

However when i try to make actions on the property, its getting failed as username is getting null reference error and when i see that page during initialization i can see the following variables, and in here username and password are null.
image

@wakaleo
Copy link
Member

wakaleo commented May 12, 2024

I would generally advise against using @findby, but I'm not sure why it wouldn't get initialised. Have a look in the PageObject class to see if you can see any reason why it might be getting skipped.

@SrivaniChennupati
Copy link
Author

I tried with By locator Strategy and its working. However for FindBy, even if driver is null, framework is getting driver from serenity , so I don't see any issue there and I will try to debug more and see to pin point the issue

Thanks for the help @wakaleo

@wakaleo
Copy link
Member

wakaleo commented May 14, 2024

I can confirm this is still working for the projects I have tried it on. However your Page Object looks a bit odd - you shouldn't have @steps inside a page object or be creating it using the @steps annotation - that is only for step libraries. Page Objects are instantiated automatically and should not contain step libraries, only locators and page-specific logic.

@wakaleo
Copy link
Member

wakaleo commented May 19, 2024

Closed presumed resolved.

@wakaleo wakaleo closed this as completed May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants