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

Failed to initialize object with generic type via AppiumFieldDecorator #368

Closed
SButterfly opened this issue Apr 25, 2016 · 2 comments
Closed
Labels

Comments

@SButterfly
Copy link

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

Objects:

public class TempLoginPage<T> {

    public List<T> items;

    public List<T> getItems() {
        return items;
    }
}

public class LoginPage extends TempLoginPage<Object> {

    @iOSFindBy(uiAutomator = ".buttons()['Login']")
    public WebElement loginButton;
}

// main
PageFactory.initElements(new AppiumFieldDecorator(getDriver()), new LoginPage());

Crashes with:

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
    at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorateWidget(AppiumFieldDecorator.java:185)
    at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:160)
    at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:113)
    at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:105)
    at 
    ... 47 more

I'm using 3.3.0 java client

@TikhomirovSergey
Copy link
Contributor

@SButterfly
Thanks for the report

@SrinivasanTarget SrinivasanTarget mentioned this issue Apr 29, 2016
3 tasks
@TikhomirovSergey
Copy link
Contributor

The bug was fixed here: #376 #377

I've found a few possible ways for the decoration enhancement but I think it is work for the 4.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants