Skip to content

Failed to initialize object with generic type via AppiumFieldDecorator #368

Description

@SButterfly

Hello,
when I want to use pages with generic types, I get those:

Objects:

publicclassTempLoginPage<T> {
publicList<T> items;
publicList<T> getItems() {
returnitems;
}
}
publicclassLoginPageextendsTempLoginPage<Object> {
@iOSFindBy(uiAutomator = ".buttons()['Login']")
publicWebElementloginButton;
}
// mainPageFactory.initElements(newAppiumFieldDecorator(getDriver()), newLoginPage());

Crashes with:

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImplcannotbecasttojava.lang.Classatio.appium.java_client.pagefactory.AppiumFieldDecorator.decorateWidget(AppiumFieldDecorator.java:185)
atio.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:160)
atorg.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:113)
atorg.openqa.selenium.support.PageFactory.initElements(PageFactory.java:105)
at ... 47more

I'm using 3.3.0 java client

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions