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

Fixed a NullPointerException that occurred during initialization when… #3575

Closed

Conversation

bachhavdipak
Copy link
Contributor

Fixed a NullPointerException that occurred during initialization when using PageFactory

@@ -95,6 +95,7 @@ private boolean shouldInstrumentField(Field pageObjectField) {

private void updatePageObject(Object pageObject) {//, Pages pages) {
if (pageObject instanceof PageObject) {
((PageObject) pageObject).setDriver(Serenity.getWebdriverManager().getWebdriver());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't looks right. You are bypassing the hasAnInstantiatedDriver() test, which may cause problems elsewhere. If you think this is where the problem comes from, you may need to check in that method. Otherwise there may be cases where that method will return null.

Can you add a sample test that reproduces the issue (e.g. in WhenBrowsingAWebSiteUsingPageObjects) and proves that the fix works correctly?

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

Successfully merging this pull request may close these issues.

3 participants